ORA-00927: missing equal sign

匿名 (未验证) 提交于 2019-12-03 00:46:02

问题:

Im creating my first sql trigger,

CREATE OR REPLACE TRIGGER totalsalary     AFTER INSERT ON Employee     FOR EACH ROW WHEN ( NEW.Dno IS NOT NULL ) BEGIN     UPDATE Department     SET totalSalary totalSalary + NEW.salary     WHERE Dno = NEW.Dno; END ; 

but i got this error message and i dont know how to fix it

Error at line 3: PL/SQL: ORA-00927: missing equal sign  1. CREATE OR REPLACE TRIGGER SueldoTotal 2.  AFTER INSERT ON EMPLEADO 3.  FOR EACH ROW 4. WHEN ( NEW.Dno IS NOT NULL ) 5. BEGIN 

回答1:

SET totalSalary totalSalary + NEW.salary

You have a missing equal sign in the SET clause.

CREATE OR REPLACE TRIGGER totalsalary     AFTER INSERT ON Employee     FOR EACH ROW WHEN ( NEW.Dno IS NOT NULL ) BEGIN     UPDATE Department     SET totalSalary = totalSalary + :NEW.salary     WHERE Dno = :NEW.Dno; END; / 

NEW.salary

Also, this is incorrect while referencing OLD and NEW values:

:NEW.salary 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!