Reputation: 137
I'm trying to create a trigger that multiplies that salaries of employees who're paid more than 1000$ by 2 but it displaying me this error below, here's the code. I'm still discovering this "new/old" concept. But I don't see why my trigger isn't working. Does anybody know why?
CREATE OR REPLACE TRIGGER MAJ
AFTER UPDATE on EMPLOYEES
FOR EACH ROW
begin
IF (:new.salary <1000) THEN
:new.salary:= :new.salary*2;
end;
/
Upvotes: 0
Views: 39
Reputation: 13509
You are forgetting an END IF
in your code -
CREATE OR REPLACE TRIGGER MAJ
AFTER UPDATE on EMPLOYEES
FOR EACH ROW
BEGIN
IF (:new.salary <1000) THEN
:new.salary := :new.salary*2;
END IF;
END;
/
Upvotes: 1