MERGE INTO table1 t USING
(SELECT '000004' AS SENDER,'Receiver' AS RECEIVER,'1030' AS IDENTIFIER,'2016' AS CREATIONDATEANDTIME,'2' AS ACKCODE,'Test' AS ACKDESCRIPTION
FROM table1) s ON(t.SENDER = s.SENDER
AND t.IDENTIFIER = s.IDENTIFIER) WHEN MATCHED THEN
UPDATE
SET t.CREATIONDATEANDTIME = '1213',
t.RECEIVER = 'hello' WHEN NOT MATCHED THEN
INSERT (t.SENDER,
t.RECEIVER,
t.IDENTIFIER,
t.CREATIONDATEANDTIME,
t.ACKCODE,
t.ACKDESCRIPTION)
VALUES (s.SENDER,
s.RECEIVER,
s.IDENTIFIER,
s.CREATIONDATEANDTIME,
s.ACKCODE,
s.ACKDESCRIPTION)
查询输出:方案1:当没有匹配条件的数据时(t.SENDER = s.SENDER和t.IDENTIFIER = s.IDENTIFIER),我得到如下错误ORA-30926:无法稳定源表中的行集。 原因:由于大型dml活动或非确定性活动where子句,无法获得稳定的行集。 操作:删除任何非确定性where子句并重新发出dml
场景2:当数据符合条件(t.SENDER = s.SENDER和t.IDENTIFIER = s.IDENTIFIER)时,在表格中,我可以看到5个新条目。
你能帮忙吗