Oracle trigger inserting or updating
But dealing with incorrect implementation of triggers is another thing.
--Executed before DML statement BEFORE STATEMENT IS BEGIN NULL; END BEFORE STATEMENT; --Executed before each row change- : NEW, : OLD are available BEFORE EACH ROW IS BEGIN NULL; END BEFORE EACH ROW; --Executed aftereach row change- : NEW, : OLD are available AFTER EACH ROW IS BEGIN NULL; END AFTER EACH ROW; --Executed after DML statement AFTER STATEMENT IS BEGIN NULL; END AFTER STATEMENT; END compound_trigger_name; Hopefully this example with make things more clear. SALARY IS NULL) ) THEN v_index := v_index 1; v_emp_changes(v_index).upd_dt := SYSDATE; v_emp_changes(v_index).upd_by := SYS_CONTEXT ('USERENV', 'SESSION_USER'); v_emp_changes(v_index).emp_id := : NEW.emp_id; v_emp_changes(v_index).field := 'SALARY'; v_emp_changes(v_index).from_value := to_char(: OLD.
I have two primary reasons for avoiding triggers: Hopefully the first reason to avoid triggers, the maintenance headache, is fairly easy to see.
Suppose you are working on someone else’s project, because you have inherited someone else’s work. When you run an update and see “1 row processed,” 500 other things may also have happened.
Our technologist looks at trigger maintenance and implementation challenges.
Those of you who frequent the asktom.Web site know that I have an aversion to triggers.