Oracle if inserting or updating then
g_change_INSERT INTO tab1_audit VALUES g_change_tab(i); g_change_tab.delete; END AFTER STATEMENT; END tab1_compound_trigger; / From a timing point perspective, the Compound Trigger Restrictions follow very closely with those of individual statement and row level triggers.
CREATE OR REPLACE TRIGGER tab1_compound_trigger FOR INSERT OR UPDATE ON tab1 COMPOUND TRIGGER TYPE t_change_tab IS TABLE OF tab1_audit%ROWTYPE; g_change_tab t_change_tab := t_change_tab(); AFTER EACH ROW IS BEGIN g_change_tab.extend; g_change_tab(g_change_tab.last):= tab1_audit_seq.
If multiple compound triggers are defined for the same object, their order of execution can be controlled using the clause, but this cannot be used to control execution order when both compound and regular DML triggers are defined against a single object.
In such situations it is better to stick with all DML triggers, or all compound triggers.
END BEFORE STATEMENT; BEFORE EACH ROW IS BEGIN NULL; -- Do something here.
END BEFORE EACH ROW; AFTER EACH ROW IS BEGIN NULL; -- Do something here.
The CREATE TRIGGER statement has a lot of permutations, but the vast majority of the questions I'm asked relate to basic DML triggers.