As we’ve already created both the tables in above example, we will directly write a trigger for ‘AFTER UPDATE’.CREATE or REPLACE TRIGGER emp_after_update AFTER UPDATE OF empid ON emp FOR EACH ROW DECLARE BEGIN update emp_backup set empid = :new.empid where empid = :old.empid; DBMS_OUTPUT.
Oracle trigger if inserting or updating love bug dating fort collins
If no WHEN clause is supplied, the SQL statements are executed every time the trigger fires.
The BEFORE or AFTER keyword determines when the trigger actions will be executed relative to the insertion, modification or removal of the associated row.
This is because compound trigger in oracle 11g has a declarative section where one can declare variable to be used within trigger.
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.