I have a table DOMAINS
in 2 different schemas with columns ID
, NAME
,CODE
,DESCRIPTION
.
For any NAME
exist in new schema, it should use existing ID
without any merge; for those new NAME
records, it should insert with ID
from old schema.
MERGE INTO DOMAINS A
USING (SELECT ID,NAME,CODE,DESCRIPTION FROM <Old Schema 6.1>.DOMAINS@DB_MIG_61_TO_74) B
ON(A.NAME = B.NAME)
WHEN MATCHED **<do nothing>**
WHEN NOT MATCHED THEN INSERT(A.ID,A.NAME,A.CODE,A.DESCRIPTION)
VALUES(B.ID,B.NAME,B.CODE,B.DESCRIPTION);
How can i intepret the portion of do nothing
in above query?
Oracle SQL syntax supports not having any
when matched then update
clause.As an example :
portion may be used for nothing to be changed.
SQL Fiddle Demo