日期:2014-05-17  浏览次数:20689 次

请指点哪里错了,谢谢
新手,刚弄了一个,有点疑惑,谢谢了
create or replace trigger UserToTemp after insert or update or delete
on BETRAYLIST for each row
declare
  integrity_error exception;
  errno integer;
  errmsg char(200);
  dummy integer;
  found boolean;
begin
if inserting then
  insert into FINISHREPORT(fID,NameBetray) values(fID=:NEW.fID,NameBetray=:NEW.NameBetray);
elsif updating then 
  update FINISHREPORT set NameBetray=:NEW.NameBetray where fID=:OLD.fID;
elsif deleting then
  delete from FINISHREPORT where fID=:OLD.fID;
end if;
exception
  when integrity_error then
  raise_application_error(errno, errmsg);
end;



请看一下哪里出错了

------解决方案--------------------
SQL code

create or replace trigger UserToTemp
  after insert or update or delete on BETRAYLIST
  for each row
declare
  integrity_error exception;
  errno  integer;
  errmsg char(200);
  dummy  integer;
  found  boolean;
begin
  if inserting then
    insert into FINISHREPORT
      (fID, NameBetray)
    values
      (:NEW.fID, :NEW.NameBetray);   --(fID=:NEW.fID,NameBetray=:NEW.NameBetray)有问题,语法不对
  elsif updating then
    update FINISHREPORT
       set NameBetray = :NEW.NameBetray
     where fID = :OLD.fID;
  elsif deleting then
    delete from FINISHREPORT where fID = :OLD.fID;
  end if;
exception
  when integrity_error then
    raise_application_error(errno, errmsg);
end;