Oracle trigger if updating then
But, when it hits else blocks it runs insert statements which are supposed to run.
This common state is established at the start of triggering statement and is destroyed after completion of trigger (regardless of trigger being in error or not).
If same had to be done without compound-trigger, it might have been required to share data using packages.
This question is Hello Tom- my requirement is When a record is inserted into ERR table, a post-event trigger will fire updating the D field to accept sys date (3 columns has to update in my original requirement).
I've written the below code, however after the record is inserted it's not being updated with sys date in D rather I got the mutating error. SQL insert into err(x) values(2); insert into err(x) values(2) * ERROR at line 1: ORA-04091: table ERR is mutating, trigger/function may not see it ORA-06512: at "TRIG_2", line 3 ORA-04088: error during execution of trigger 'TRIG_2' SQL thank you very much for your help and suggestions.
--Trigger CREATE OR REPLACE TRIGGER aud_emp FOR INSERT OR UPDATE ON employees COMPOUND TRIGGER TYPE t_emp_changes IS TABLE OF aud_emp%ROWTYPE INDEX BY SIMPLE_INTEGER; v_emp_changes t_emp_changes; v_index SIMPLE_INTEGER := 0; v_threshhold CONSTANT SIMPLE_INTEGER := 1000; --maximum number of rows to write in one go. Hope that helped to have a better understanding of Compound Triggers in Oracle.