oracle – update rows using joins and select statement

To update rows resulting from join of several tables, use following syntax in oracle:

MERGE INTO table_to_update t
USING (select field1, field2 from other_table) t2
ON (trim(t.field1 = t2.field1)
WHEN MATCHED THEN UPDATE
SET t.field3 = t2.field2
where t.field3 = t2.field2 and t.field4 like '%DUMMY%';

example:

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...