Can anyone help me understand when to use :NEW and :OLD in PLSQL blocks, I\'m finding it very difficult to understand their usage.
:old and :new are pseudorecords referred to access row level data when using row level trigger.
For Below operation, respective old and new values:
Eg:
CREATE OR REPLACE TRIGGER get_dept
BEFORE DELETE OR INSERT OR UPDATE ON employees
FOR EACH ROW
BEGIN
DBMS_OUTPUT.PUT('Old Dept= ' || :OLD.dept|| ', ');
DBMS_OUTPUT.PUT('New Dept= ' || :NEW.dept );
END;
Triggering Statement:
UPDATE employees
SET dept ='Accounts'
WHERE empno IN (101 ,105);