Oracle MERGE: only NOT MATCHED is triggered
问题 Database: Oracle Table: CREATE TABLE TABLE_FOR_TESTS ( d DATE, t NUMBER(8) ) MERGE: MERGE INTO TABLE_FOR_TESTS USING DUAL ON ((SELECT COUNT(*) FROM TABLE_FOR_TESTS) = 1) WHEN MATCHED THEN UPDATE SET T = T+1 WHEN NOT MATCHED THEN INSERT (D, T) VALUES (sysdate, 1) or ... ON ((SELECT T FROM TABLE_FOR_TESTS) is not null) ... I will refer to the first version of MERGE, but the second one has the same effect. 1) I run that MERGE for the first time result: expected (because there is no element, the