CREATE TABLE AUDIT_EMP
(RCD DATE, EMPID NUMBER(4), old_salary NUMBER(7,2), new_salary NUMBER(7,2)
);
SELECT * FROM AUDIT_EMP;
CREATE OR REPLACE TRIGGER audit_emp_values
AFTER DELETE OR INSERT OR UPDATE ON emp
FOR EACH ROW
BEGIN
INSERT INTO audit_emp
VALUES ( SYSDATE, :OLD.empno,:OLD.sal, :NEW.sal );
END;
UPDATE EMP SET SAL = SAL+100 WHERE EMPNO =7369;
SELECT * FROM AUDIT_EMP;
Comments