delete code in trigger throwing up errors oracle -
i don't know how code throws errors. compiles correctly when used throws error.
create or replace trigger trg_applications before insert or update of app_id, status_id on applications each row begin :new.app_id := seq_app_id.nextval; :new.app_date := sysdate; if updating , ( :new.status_id = 2 or :new.status_id = 5 or :new.status_id = 7 or :new.status_id = 8 ) insert app_history (srn, status_id, app_date) values (:old.srn, :old.status_id, :old.app_date); delete applications :new.status_id = 2; delete applications :new.status_id = 5; delete applications :new.status_id = 7; delete applications :new.status_id = 8; end if; end;
this error message
error ora-04091: table apex514.applications mutating, trigger/function may not see ora-06512: @ "apex514.trg_applications", line 14 ora-04088: error during execution of trigger 'apex514.trg_applications'
the cause of mutating table error misuse of triggers. here typical example: 1.you insert row in table a
2.a trigger on table (for each row) executes query on table a, example compute summary column
3.oracle throws ora-04091: table mutating, trigger/function may not see it
source further reading. http://dba.stackexchange.com/questions/5432/what-are-the-causes-and-solutions-for-mutating-table-errors
Comments
Post a Comment