1 CREATE OR REPLACE TRIGGERTrgregisterpregroup2BeforeUPDATE3 ontblregisterusers4 forEach ROW5 6 DECLARE7sort_idvarchar2( -);8E_codeVARCHAR2( +);9 BEGINTen IF: New.fldleftmoney<>: Old.fldleftmoney Then One SelectTo_char (Systimestamp (3),'YYYYMMDDHH24MISSFF') intosort_id fromdual; AE_code:= NULL; - forRinch(SelectA.fldusergroupid, - A.FLDX, the A.fldy, - A.fldz, - A.fldserviceaid, - A.fldservicebid, + A.fldservicecid, - A.flag + fromUsergroupautoconfig a A whereA.fldusergroupid=: New.fldusergroupid andA.flag=1) at Loop - if: New.fldleftmoney>R.fldz Then - ifR.fldservicecid is not NULL Then -E_code:=Pk_interface.user_pregroup (: NEW. Fldusername,r.fldservicecid,sysdate,9000, sort_id); - End if; -elsif (: New.fldleftmoney<=R.FLDZ) and(: New.fldleftmoney>R.fldy) Then in ifR.fldservicebid is not NULL Then -E_code:=Pk_interface.user_pregroup (: NEW. Fldusername,r.fldservicebid,sysdate,9000, sort_id); to End if; + Else - ifR.fldserviceaid is not NULL Then theE_code:=Pk_interface.user_pregroup (: NEW. Fldusername,r.fldserviceaid,sysdate,9000, sort_id); * End if; $ End if;Panax Notoginseng EndLoop; - End if; the ifE_code<>Pk_common. E00 Then +Pk_public.error_log ('Trgregisterpregroup:' ||: New.flduserid|| '-' ||e_code); A End if; the EXCEPTION + whenOTHERS Then - NULL; $ ENDTrgregisterpregroup;
Trigger Trigger in Oracle