Old pseudo record in After Insert Trigger
I've got the following test trigger which I copied from a book:
TRIGGER bef_ins_ceo_comp
BEFORE INSERT
ON ceo_compensation
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO ceo_comp_history
VALUES (:NEW.name,
:OLD.compensation, :NEW.compensation,
'AFTER INSERT', SYSDATE);
COMMIT;
END;
As you can see when inserting a new record to the ceo_comp_history t开发者_开发技巧able :OLD.compensation value is used. I wonder where does that :OLD pseudo record come from? It's not an update trigger to keep both :NEW and :OLD values.
My guess is the :OLD
values will be all NULL. Code is probably just a copy/paste from the update trigger
精彩评论