1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
-- create a temporary table
CREATE TABLE emp_sal_log (emp_id NUMBER, log_date DATE,
new_salary NUMBER, action VARCHAR2(50)); <==première erreur ici!
CREATE OR REPLACE TRIGGER log_salary_increase -- create a trigger
BEFORE UPDATE of salary ON employees FOR EACH ROW
WHEN (OLD.salary < 8000)
BEGIN
INSERT INTO emp_sal_log (emp_id, log_date, new_salary, action)
VALUES (:NEW.employee_id, SYSDATE, :NEW.salary, 'New Salary');
END;
/
-- update the salary with the following UPDATE statement
-- trigger fires for each row that is udpated
UPDATE employees SET salary = salary * 1.01 WHERE department_id = 60;
-- view the log table
SELECT * FROM emp_sal_log; |