I have the following statement:
MERGE INTO ( SELECT t.dname
,t.loc
,t.rg_deptno
FROM rg_dept t
where rg_deptno = -123
) old_data
USING ( SELECT e.deptno, TO_CHAR(ROWNUM) rno
FROM rg_emp e
WHERE e.mgr = ‘123’
) new_data
ON ( old_data.rg_deptno = new_data.deptno
)
WHEN MATCHED THEN UPDATE SET
old_data.loc = ‘Old’
WHEN NOT MATCHED THEN INSERT
(dname
,loc
,rg_deptno
)
VALUES ( ‘Test’||new_data.rno
,‘New’
,new_data.deptno
);
This runs without issue when I press F9 and execute the statement.
When I try to format the code I get “ERROR line 2, col 12, ending_line
2, ending_col 12, Found ‘(’, Invalid identifier: (”
I’m running this in Toad For Oracle Professional version 10.1.1.8.
–
Rumpi Gravenstein