I have the following SQL code (this is how much I made so far):
MERGE INTO SCHEMA_1.TABLE_1 table1
USING
(
SELECT *
FROM SCHEMA_2.TABLE_2 table2
LEFT JOIN SCHEMA_2.VIEW_1 view1
ON table2.COLUMN_4 = view1.COLUMN_1
)t2
ON(table1.COLUMN_2 = t2.COLUMN_5)
WHEN MATCHED THEN UPDATE SET
table1.COLUMN_3 = t2.COLUMN_6
where table1.COLUMN_2 in
(
select
table1.COLUMN_2
from
SCHEMA_1.TABLE_1 table1,
SCHEMA1.TABLE_3 table3,
SCHEMA1.TABLE_4 table4,
SCHEMA1.TABLE_5 table5,
SCHEMA1.TABLE_6 table6,
SCHEMA1.TABLE_7 table7
where
table4.COLUMN_7 = table3.COLUMN_8 and
table5.COLUMN_9 = table4.COLUMN_10 and
table5.COLUMN_11 = table1.COLUMN_12 and
table4.COLUMN_13 = table7.COLUMN_14 and
table7.COLUMN_15 = table6.COLUMN_16 and
table6.COLUMN_17 = 'DOL' and
table4.COLUMN_18 = 1 and
table1.COLUMN_2 is not null and
table1.COLUMN_3 is null
order by
table1.COLUMN_19 desc
);
But I am getting the following error message:
SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"
Why is this error coming? Where to change the code to make it work?
Thanks for help!