我不知道为什么您只想更新而不是插入时尝试使用 MERGE。您不能像现在这样在 WHEN 子句中添加条件 - 请参阅文档。
为什么不这样做:
update qot
set qot_exc_id = case qot_exc_id
when 4 then 259
when 6 then 131
end
where qot_id = 1023125885
and qot_exc_id in (4,6);
如果你真的需要一个 MERGE 那么你想要这样的东西:
MERGE INTO qot
USING dual
ON (qot_id = 1023125885)
WHEN MATCHED THEN
UPDATE SET qot_exc_id = case qot_exc_id
when 4 then 259
when 6 then 131
else qot_exc_id
end;
也许:
MERGE INTO qot
USING dual
ON (qot_id = 1023125885 and qot_exc_id in (4,6))
WHEN MATCHED THEN
UPDATE SET qot_exc_id = case qot_exc_id
when 4 then 259
when 6 then 131
end;