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;

你可能感兴趣的:(trigger)