When creating an
Instead Of trigger, Sql Developer allows to include all 3 DML actions in the same trigger:
The result SQL looks like:
CREATE OR REPLACE TRIGGER TRIGGER1 INSTEAD OF DELETE OR INSERT OR UPDATE ON PO_COSTED_BOM_V BEGIN NULL; END;
I'm able to combine
Update like this:
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_VALUE WHERE CFG_NAME = :NEW.CFG_NAME; IF SQL%NOTFOUND THEN INSERT INTO SRC_TBL (CFG_NAME, CFG_VALUE) VALUES(:NEW.CFG_NAME, :NEW.CFG_VALUE); END IF; END;
- But how do i get the
Deletestatement into the trigger?
- How does the trigger know which DML action was executed?