Oracle Merge Into
说明
插入或更新
示例
MERGE INTO TARGET_TABLE T
USING (
SELECT * FROM SOURCE_TABLE S
WHERE 1=1
) S
ON (T.ID = S.ID)
WHEN MATCHED THEN
UPDATE SET T.VALUE=S.VALUE
WHERE 1=1
WHEN NOT MATCHED THEN
INSERT (T.ID, T.VALUE) VALUES (S.ID, S.VALUE)
;