【发布时间】:2017-10-16 19:54:49
【问题描述】:
我正在尝试创建一个简单的触发器,但出现以下错误。我在互联网上搜索但找不到解决方案。你能帮我解决这个问题吗?
create trigger ProcessTigger before insert on T039
for each row
declare consecutivo int; idconsecutivo int; maxconsecutivo int;
begin
select t326c004 into consecutivo from T326 where t326c003 = 'T039' and t326c002 = :new.t039c004;
if consecutivo is not null
then
consecutivo :=consecutivo+1;
select t326c001 into idconsecutivo from T326 where t326c002 = :new.t039c004 and t326c003=T039;
update T326 set t326c004 = consecutivo where t326c001=idconsecutivo and t326c003=T039;
else
select max(t039c003) into maxconsecutivo from T039 where t071c002=:new.t039c004;
if maxconsecutivo is not null
then consecutivo := maxconsecutivo+1;
else consecutivo:=1;
end if;
insert into T326
(t326c002,t326c003,t326c004)values(:new.t039c004,'T039',consecutivo);
end if;
end;
错误:
SP2-0552:未声明绑定变量“NEW”。
【问题讨论】:
-
那么,它是什么? ORA-04071,触发器缺少 BEFORE/AFTER/INSTEAD OF 子句?还是 SP2-0552,未声明绑定变量“NEW”? Oracle 一次抛出一个错误,因此不可能同时出现。
-
对不起,我的问题标题错了。问题是或 SP2-0552,未声明绑定变量“NEW”
-
使用您帖子下方的小
edit链接进行编辑 - 您可以更改标题以匹配您的问题。
标签: oracle plsql database-trigger