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)
;
posted @ 2021-04-23 09:06  太晓  阅读(65)  评论(0编辑  收藏  举报