大家帮忙看下~~触发器~~
create or replace trigger trg_i_bdz_xlmc2003
after insert
on line_hour_xs2003
for each row
declare
bdzmc varchar2(30);
xlmc varchar2(30);
begin
bdzmc := :new.bdzmc;
xlmc := :new.xlmc;
if (bdzmc!= " " and xlmc!= " ") then
begin
if (select count(*) from bdz_xlmc2003 where bdzmc=bdzmc and xlmc=xlmc)=0 then
begin
insert into bdz_xlmc2003 values (bdzmc,xlmc) ;
commit;
exception when others then
rollback;
dbms_output.put_line( "Invalid inserted ");
end;
end if;
end;
end if;
end;
该触发器运行时报错,if (select count(*) from bdz_xlmc2003 where bdzmc=bdzmc and xlmc=xlmc)=0 then...报在这个地方,好像没有什么错吧。
请高手指点~~~
------解决方案--------------------先select into到一个变量,再判断变量。逻辑上的错误还有个就是变量名不能与字段同名。