我讨厌这样做,但我的 SQL 很弱,我无法使用错误消息来纠正语法进行故障排除。有人可以帮助检查我的语法并查看导致错误的原因吗?我认为这与 DECLARE 和 BEGIN 有关。也许我应该删除声明?
我得到的错误是PLS-00103: Encountered the symbol "INSERT" when expecting one of the following: . ( * @ % & = - + < / > at in is mod remainder not rem then <an exponent (**)> <> or != or ~= >= <= <> and or lik
PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following: . ( * @ % & = - + < / > at in is mod remainder not rem then <an exponent (**)> <> or != or ~= >= <= <> and or lik <BR>
我创建触发器的语法:
create or replace trigger emp_dept_briu
instead of insert or update on emp_dept_v
referencing new as n
old as o
for each row
declare
l_deptno emp.deptno%type;
begin
case
when inserting
insert into emp
( empno, ename , deptno)
values
( :n.empno, :n.ename, :n.deptno )
;
insert into dept
( deptno, dname )
values
( :n.deptno, :n.dname )
;
when updating
update emp
set ename = :n.ename
, deptno = :n.deptno
where empno = :n.empno
;
update dept
set dname = :n.dname
where deptno = :n.deptno
;
else
null
;
end case
;
end
;