Oracle doesn't have on duplicate key update Use MERGE instead:

Oracle doesn't have on duplicate key update Use MERGE instead:

MERGE INTO my_table trg  
USING (SELECT 30 as question_id,0 as ug FROM DUAL
UNION ALL 
SELECT 31,1 FROM DUAL) src ON (src.question_id = trg.question_id)
WHEN NOT MATCHED THEN INSERT(question_id, ug) VALUES
(src.question_id, src.ug)
WHEN MATCHED THEN UPDATE
SET trg.ug = src.ug
posted @ 2018-04-09 15:14  kakaisgood  阅读(274)  评论(0编辑  收藏  举报