create or replace trigger cmp_apply_tgr
before insert or update
on cmp_apply for each row
begin
if inserting then
if :new.paysum = :new.applysum then
select 'Y' into :new.vdef5 from dual;
else
select 'N' into :new.vdef5 from dual;
end if;
elsif updating then
if :new.paysum = :old.applysum then
select 'Y' into :new.vdef5 from dual;
end if;
end if;
END;
主要是思路问题,用了before 就不能用update更新了,要用select * into