Chapter 7 Exercise 5

5. Create a data trigger that writes a row in a new table whenever employee salary is changed. Store the date changed, the employee, the old salary and the new value.

Create a ChangeLog table, then (in Oracle)

CREATE TRIGGER trgUpdateEmployee
	AFTER UPDATE ON Employee
	FOR EACH ROW
BEGIN
	INSERT INTO ChangeLog (EmployeeID, ChangeDateTime, OldSalary, NewSalary)
	VALUES (:NEW.EmployeeID, SYSDATE, :OLD.Salary, :NEW.Salary);
END;