Oracle if updating trigger

PUT_LINE('Record successfully inserted into emp_backup table'); END; Second Problem: We want o update a record in the ’emp_backup’ table if a corresponding record is updated in the ’emp’ table.

IMO, your best bet is to contain a functional unit of work inside of a trigger, so that there is no discrepancy in what that trigger does. Since I would like to do the same things if the row is inserted, updated, or deleted, I would like to know what's happening in the trigger.I think I can manage to find if the row is inserted or updated (I can check the old_buffer with the new_buffer). Detecting the DML Operation That Fired a Trigger If more than one type of DML operation can fire a trigger (for example, ON INSERT OR DELETE OR UPDATE OF Emp_tab), the trigger body can use the conditional predicates INSERTING, DELETING, and UPDATING to check which type of statement fire the trigger.In my experience, Developers/Business Analysts often tend to think in transaction workflows.I have found this to be especially helpful when I or others have to troubleshoot the consequences of user data corruption as it relates to triggers being fired - the less triggers you have to try to piece together the logic for, the easier it is to see how data was manipulated. Obviously the separate triggers are more efficient because you're doing fewer logical checks, but you have a decent point on the benefit of having fewer triggers.NEXTVAL INTO : NEW.my_col3 FROM DUAL; END IF; IF : NEW.my_col4 IS NULL THEN (...) END IF; END IF; END; / -- Scenario 2 CREATE OR REPLACE TRIGGER my_trg1 BEFORE INSERT ON my_table FOR EACH ROW BEGIN IF : NEW.my_col3 IS NULL THEN SELECT my_seq.


Leave a Reply