merge into的语法:
MERGE INTO 表名 A USING [source table sql B] C ON([conditional expression] and […]…)
WHEN MATCHED THEN
[UPDATE sql]
WHEN NOT MATCHED THEN
[INSERT sql]
例:
merge into A USING (select B.ID,B.NAME,B.YEAR from B) C ON(A.ID=C.ID)
WHEN MATCHEDTHEN
UPDATE A.NAME=B.NAME
WHEN NOT MATCHED THEN
insert(A.ID,A.NAME,A.YEAR) VALUES(C.AID,C.NAME,C.YEAR);