Oracle而不是触发器

时间:2016-11-30 06:21:31

标签: oracle triggers

我收到了错误 Error(2,67): PLS-00049: bad bind variable OLD.DEPTNAME while executing below trigger也在SQL开发人员中获得'输入绑定'提示

create or replace trigger emp_Dept_view_trig
instead of update on emp_Dept_view
for each row 
begin
update department set LOCATION  = :NEW.LOCATION  where DEPTNAME:OLD.DEPTNAME;
commit;
end;

1 个答案:

答案 0 :(得分:0)

试试这个

CREATE OR REPLACE TRIGGER emp_Dept_view_trig
   INSTEAD OF UPDATE
   ON emp_Dept_view
   FOR EACH ROW
BEGIN
   UPDATE department
      SET LOCATION = :NEW.LOCATION
    WHERE DEPTNAME=:OLD.DEPTNAME; 
    commit; end;