第二個觸發器沒有理由不會觸發,還有其他事情正在發生。
這裏有一個小的測試案例,顯示了所有正確觸發火警當單個事務修改單排幾次:
SQL> CREATE TABLE a (ID NUMBER);
Table created
SQL> CREATE TABLE b (action VARCHAR2(3), id_old NUMBER, id_new NUMBER);
Table created
SQL> CREATE TRIGGER trg_a_ins BEFORE INSERT ON a FOR EACH ROW
2 BEGIN
3 INSERT INTO b VALUES ('ins', :old.id, :new.id);
4 END;
5/
Trigger created
SQL> CREATE TRIGGER trg_a_upd BEFORE UPDATE ON a FOR EACH ROW
2 BEGIN
3 INSERT INTO b VALUES ('upd', :old.id, :new.id);
4 END;
5/
Trigger created
SQL> CREATE TRIGGER trg_a_del BEFORE DELETE ON a FOR EACH ROW
2 BEGIN
3 INSERT INTO b VALUES ('del', :old.id, :new.id);
4 END;
5/
Trigger created
SQL> INSERT INTO a VALUES (1);
1 row inserted
SQL> UPDATE a SET ID = 2 WHERE ID = 1;
1 row updated
SQL> DELETE FROM a WHERE ID = 2;
1 row deleted
SQL> select * from b;
ACTION ID_OLD ID_NEW
------ ---------- ----------
ins 1
upd 1 2
del 2
感謝您的測試用例。結構的圖片接近我們的(當然更復雜)。我試過了,它工作。確實,還有其他的東西。 – Ashygan