Oracle
 sql >> Base de données >  >> RDS >> Oracle

Oracle :SUR LA MISE À JOUR DE LA CLÉ EN DOUBLE

Oracle n'a pas on duplicate key update Utilisez MERGE à la place :

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