这是我的问题:
我试图运行的MERGE语句遇到错误。所以 - 为了找到罪魁祸首 - 我创建了两个触发器(一个用于UPDATE,另一个用于INSERT)
由于MERGE语句将失败 - 我已将自动事务添加到触发器,以便捕获罪魁祸首记录,无论事务是失败还是成功。
CREATE OR REPLACE TRIGGER test_ins
before insert on
cust
referencing old as old
new as new
for each row
declare
pragma autonomous_transaction;
begin
insert into cust_audit
(
CUST_ID
)
values
(
:new.CUST_ID
);
commit;
end;
CREATE OR REPLACE TRIGGER test_upd
before UPDATE on
cust
referencing old as old
new as new
for each row
declare
pragma autonomous_transaction;
begin
insert into cust_audit
(
CUST_ID
)
values
(
:new.CUST_ID
);
commit;
end;
当MERGE成功时触发器起作用,但是当它失败时 - * AUDIT表中没有行。
有什么想法吗?