Oracle触发器在MIS 开发中的应用
create or replace trigger trig_ysd
本文链接地址:http://www.oyaya.net/fanwen/view/140148.html
after insert or update or delete on bj_ysd
for each row
declare rq1 varchar2(8);rq2 varchar2(8);
/*限于篇幅,yssl1,yssl2,ysdj1,ysdj2,bjbm1,bjbm2,ii声明略*/
if inserting or updating then
rq1:=:new.rq;bjbm1:=:new.bjbm;yssl1:=:new.yssl;
ysdj1:=:new.ysdj;
select count(*) into ii from bj_dqkcb
where bjbm=bjbm1;
if ii=0 then
insert into bj_dqkcb(bjbm,dqkcl,dqkcje)
value(bjbm1,yssl1,ysdj1);
else
update bj_dqkcb
set dqkcl=dqkcl+yssl1;
dqkcje=dqkcje+yssl1*ysdj1;
end if
end if
if deleting o
《Oracle触发器在MIS 开发中的应用(第5页)》