Oracle中的觸發器TRIGGER

來源:互聯網
上載者:User

標籤:when   end   except   to_char   觸發器   ldl   conf   _id   for   

 1 CREATE OR REPLACE TRIGGER trgregisterpregroup 2   BEFORE UPDATE 3   ON tblregisterusers 4   FOR EACH ROW 5  6 DECLARE 7 sort_id varchar2(2000); 8 e_code  VARCHAR2(1000); 9 BEGIN10       IF :NEW.fldleftmoney <> :OLD.fldleftmoney THEN11         select to_char(systimestamp(3),‘YYYYMMDDHH24MISSFF‘) into sort_id from dual;12         e_code := NULL;13         for R in (select a.fldusergroupid,14                        a.fldx,15                        a.fldy,16                        a.fldz,17                        a.fldserviceaid,18                        a.fldservicebid,19                        a.fldservicecid,20                        a.flag21                   from usergroupautoconfig a22                  where a.fldusergroupid = :NEW.fldusergroupid and a.flag=1)23           loop24             if :NEW.fldleftmoney > R.fldz then25               if R.fldservicecid is not null then26                  e_code := PK_INTERFACE.user_pregroup(:NEW.FLDUSERNAME,R.fldservicecid,sysdate,9000,sort_id);27               end if;28             elsif (:NEW.fldleftmoney <= R.fldz) and (:NEW.fldleftmoney > R.fldy) then29               if R.fldservicebid is not null then30                  e_code := PK_INTERFACE.user_pregroup(:NEW.FLDUSERNAME,R.fldservicebid,sysdate,9000,sort_id);31               end if;32             else33               if R.fldserviceaid is not null then34                  e_code := PK_INTERFACE.user_pregroup(:NEW.FLDUSERNAME,R.fldserviceaid,sysdate,9000,sort_id);35               end if;36             end if;37           end loop;38        end if;39     if e_code <> pk_common.E00 then40           PK_PUBLIC.error_log(‘trgregisterpregroup: ‘ || :NEW.flduserid || ‘-‘ || e_code);41         end if;42      EXCEPTION43       WHEN OTHERS THEN44         NULL;45 END trgregisterpregroup;

 

Oracle中的觸發器TRIGGER

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.