我是靠谱客的博主 能干流沙,最近开发中收集的这篇文章主要介绍Create trigger,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

CREATE OR REPLACE TRIGGER SIGN_FL_ALL_BFD

   BEFORE DELETE

   ON SIGN_FL_ALL

   REFERENCING NEW AS NEW OLD AS OLD

   FOR EACH ROW

BEGIN

   INSERT INTO SIGN_FL_ALL_HISTORY

                                         (seq,

                                           authorization_amount,

                                           PROCESSED_BY,

                                           PROCESS_DATE)

   VALUES

                                         ( :OLD.seq,

                                           :OLD.authorization_amount,

                                           Fnd_Global.USER_ID,

                                           SYSDATE);

END;

------ table trigger

create or replace trigger MSL_BND_EBPT_HISTORY_BEF

  before DELETE or update ON MSL_BND_EBPT

  REFERENCING NEW AS NEW OLD AS OLD

  FOR EACH ROW

/**************************************************/

|| Create by Jovi.tang

|| create date 14-APR-2009

|| Purpose:record historical informations

/*************************************************/

BEGIN

  INSERT INTO MSL_BND_EBPT_HISTORY

    (EPTG_START_DATE,

     LAST_UPDATE_DATE,

     LAST_UPDATED_BY,

     CREATION_DATE,

     CREATED_BY,

     LAST_UPDATE_LOGIN)

  values

    (:OLD.EPTG_START_DATE,

     sysdate,

     fnd_global.USER_ID,

     sysdate,

     :OLD.CREATED_BY,

     fnd_global.USER_ID);

end;

-----view trigger

create or replace trigger GMA_MR_TEXT_TBL_T2

instead of update on MR_TEXT_TBL_VL

referencing old as MR_TEXT_TBL

for each row

begin

  GMA_MR_TEXT_TBL_PKG.UPDATE_ROW(

    X_ROW_ID => :MR_TEXT_TBL.ROW_ID,

    X_TEXT_CODE => :MR_TEXT_TBL.TEXT_CODE,

    X_LANG_CODE => :MR_TEXT_TBL.LANG_CODE,

    X_PARAGRAPH_CODE => :MR_TEXT_TBL.PARAGRAPH_CODE,

    X_SUB_PARACODE => :MR_TEXT_TBL.SUB_PARACODE,

    X_LINE_NO => :MR_TEXT_TBL.LINE_NO,

    X_TEXT => :MR_TEXT_TBL.TEXT,

    X_LAST_UPDATE_DATE => :MR_TEXT_TBL.LAST_UPDATE_DATE,

    X_LAST_UPDATED_BY => :MR_TEXT_TBL.LAST_UPDATED_BY,

    X_LAST_UPDATE_LOGIN => :MR_TEXT_TBL.LAST_UPDATE_LOGIN);

end UPDATE_ROW;

-------

CREATE OR REPLACE TRIGGER BNDOWNER.BIU_CT_USERS

BEFORE INSERT  OR UPDATE

ON CT_USERS

REFERENCING NEW AS NEW OLD AS OLD

FOR EACH ROW

BEGIN

  If Updating Then

      :NEW.Maint_Date := Sysdate;

      :NEW.Maint_Userid := User;

  Else if Inserting Then

     :NEW.Added_Userid := User;

     :NEW.Added_Date := Sysdate;

     :NEW.Maint_Userid := User;

     :NEW.Maint_Date := Sysdate;

     if :new.expire_day is null then

        :new.expire_day := add_months(sysdate,120);

     end if;

  End if;

  End if;

END;

------

CREATE OR REPLACE TRIGGER PS_LOOKUPS_GLOBAL_T

AFTER INSERT  OR UPDATE OR DELETE

ON PS_LOOKUPS_all

REFERENCING NEW AS NEW OLD AS OLD

FOR EACH ROW

DECLARE

  P_SEQNO    NUMBER;

  P_COMPANY_CODE  VARCHAR2(2):='06';

  P_ERPSITE    VARCHAR2(10):='R11i';

  P_ACD_TYPE_A    VARCHAR2(10):='ADD';

  P_ACD_TYPE_C    VARCHAR2(10):='CHANGE';

  P_ACD_TYPE_D    VARCHAR2(10):='DELETE';

BEGIN

  SELECT PS_LOOKUPS_GLOBAL_S.NEXTVAL

    INTO P_SEQNO FROM DUAL;

  IF INSERTING  THEN

    INSERT INTO PS_LOOKUPS_INTERFACE(

    LAST_UPDATE_DATE,

    LAST_UPDATED_BY,

    CREATION_DATE,

    CREATED_BY,

    LAST_UPDATE_LOGIN)

    VALUES(:NEW.LAST_UPDATE_DATE,

    :NEW.LAST_UPDATED_BY,

    :NEW.CREATION_DATE,

    :NEW.CREATED_BY,

    :NEW.LAST_UPDATE_LOGIN);

  ELSIF UPDATING THEN

    INSERT INTO PS_LOOKUPS_INTERFACE(

    LAST_UPDATE_DATE,

    LAST_UPDATED_BY,

    CREATION_DATE,

    CREATED_BY,

    LAST_UPDATE_LOGIN)

    VALUES(:NEW.LAST_UPDATE_DATE,

    :NEW.LAST_UPDATED_BY,

    :NEW.CREATION_DATE,

    :NEW.CREATED_BY,

    :NEW.LAST_UPDATE_LOGIN);

  ELSIF DELETING THEN

    INSERT INTO PS_LOOKUPS_INTERFACE(LAST_UPDATE_DATE,

    LAST_UPDATED_BY,

    CREATION_DATE,

    CREATED_BY,

    LAST_UPDATE_LOGIN)

    VALUES(:OLD.LAST_UPDATE_DATE,

    :OLD.LAST_UPDATED_BY,

    :OLD.CREATION_DATE,

    :OLD.CREATED_BY,

    :OLD.LAST_UPDATE_LOGIN);

  END IF;

END;

转载于:https://www.cnblogs.com/quanweiru/archive/2012/07/31/2616142.html

最后

以上就是能干流沙为你收集整理的Create trigger的全部内容,希望文章能够帮你解决Create trigger所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(67)

评论列表共有 0 条评论

立即
投稿
返回
顶部