Trigger if updating then

posted by | Leave a comment

The T-SQL for creating this trigger is shown below.

The workaround for this is to use variables defined in packages to store information that must be in scope for all timing points.The following code demonstrates the order in which the timing points are fired.It creates a test table, a package to hold shared data and a trigger for each of the timing points.After the T-SQL UPDATE command, we then execute a T-SQL SELECT query to make sure the trigger executed correctly.The output from the UPDATE and SELECT statements are shown below.

CREATE OR REPLACE TRIGGER TRIGGER1 INSTEAD OF INSERT OR UPDATE OR DELETE ON PO_COSTED_BOM_V BEGIN UPDATE SRC_TBL SET CFG_VALUE = : NEW. CFG_NAME; IF SQL%NOTFOUND THEN INSERT INTO SRC_TBL (CFG_NAME, CFG_VALUE) VALUES(: NEW. CFG_VALUE); END IF; END; 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), the trigger body can use the conditional predicates INSERTING, DELETING, and UPDATING to check which type of statement fire the trigger.

Leave a Reply

lovedatingmarriage com