下面是一个触发器
create or replace trigger d_update
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete e when deptno = :old.deptno;
end if;
end;在编译的时候产生错误
SQL> show errors
Errors for TRIGGER SCOTT.D_UPDATE:
LINE/COL ERROR
-------- -------------------------------------
6/19 PL/SQL: ORA-00933: SQL 命令未正确结束
6/5 PL/SQL: SQL Statement ignored请问一下,上面的错误如何修改,谢谢
create or replace trigger d_update
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete e when deptno = :old.deptno;
end if;
end;在编译的时候产生错误
SQL> show errors
Errors for TRIGGER SCOTT.D_UPDATE:
LINE/COL ERROR
-------- -------------------------------------
6/19 PL/SQL: ORA-00933: SQL 命令未正确结束
6/5 PL/SQL: SQL Statement ignored请问一下,上面的错误如何修改,谢谢
create or replace trigger d_update
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete from e where deptno = :old.deptno;
end if;
end;
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete e when deptno = :old.deptno;
end if;
end;
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete from e when e.deptno = :old.deptno;
end if;
end;
after delete or update of deptno on d
for each row
begin
if (updating and :old.deptno != :new.deptno) then
update e set deptno = :new.deptno where deptno = :old.deptno;
end if;
if deleting then
delete from e where e.deptno = :old.deptno;
end if;
end;
----》delete e where deptno = :old.deptno;