Trigger errors ORA-04092 ORA-04088

一曲冷凌霜 提交于 2019-12-02 05:40:14

Just remove

COMMIT;

from the trigger code. Trigger execute in an ongoing transaction, so you cannot do a separate commit. When the transaction is commited, your insert in trigger_2 will also be commited.

Might I suggest shortening it a bit.

CREATE OR REPLACE TRIGGER trigger_test
  AFTER INSERT ON trigger_1
  FOR EACH ROW
  BEGIN
    INSERT INTO trigger_2 (IDENTIFIER,NAME) VALUES (:NEW.IDENTIFIER,:NEW.NAME);
  END;

In case you really really need to commit (chances are you don't have to, but just in case...) you can create a procedure with the AUTONOMOUS_TRANSACTION PRAGMA.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!