I have query which is working fine with MySQL, but if I execute it in Oracle database I get the following error:
SQL Error: ORA-01779: cannot modify a column which maps to a non key-preserved table
01779. 00000 - "cannot modify a column which maps to a non key-preserved table"
*Cause: An attempt was made to insert or update columns of a join view which
map to a non-key-preserved table.
*Action: Modify the underlying base tables directly
MySQL query:
UPDATE T1
INNER JOIN T2 ON T1.UIDPK =T2.UIDFK
SET T1.C1=CONCAT('EMPTY_',T2.UID) WHERE T2.C1 IS NULL ;
Changed query for Oracle:
UPDATE
(
SELECT T1.C1 AS OLD ,CONCAT('EMPTY_',T2.UID) AS NEW FROM T1
INNER JOIN T2 ON T1.UIDPK= T2.UIDFK WHERE T1.C1 IS NULL
) T3
SET T3.OLD = T3.NEW
Above query is not working in Oracle database.