Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Posts
    5

    Unanswered: DB2 Trigger inserting multiple rows in audit table for update event

    Hi,

    I have coded my Trigger as below

    CREATE TRIGGER TRIG0
    AFTER UPDATE ON INSOUDVL.STTN_V01
    REFERENCING NEW AS NAUDIT OLD AS OAUDIT
    FOR EACH ROW MODE DB2SQL
    BEGIN ATOMIC
    WHEN (NAUDIT.STTN_DELETE_MKR = ' ')
    INSERT INTO INSOUDVL.STTT_V01
    VALUES ('U',
    OAUDIT.STTN_1141_CODE ,
    OAUDIT.STTN_EASTING ,
    OAUDIT.STTN_NORTHING ,
    OAUDIT.STTN_LAST_AMENDED ,
    OAUDIT.STTN_ISSUED ,
    OAUDIT.STTN_FULL_NAME ,
    OAUDIT.STTN_CODE_TYPE ,
    NAUDIT.STTN_DELETE_MKR ,
    OAUDIT.STTN_FIBRE_IND ,
    OAUDIT.STTN_CCITT_ID ,
    OAUDIT.STTN_NODE_NUM ,
    OAUDIT.STTN_DIST_NUM_FK ,
    OAUDIT.STTN_DMIM_DIST_FK ,
    OAUDIT.STTN_DMIM_REF_FK ,
    OAUDIT.STTN_CUST_NAME_FK ,
    OAUDIT.STTN_AMENDED_BY ,
    OAUDIT.STTN_CD_AMENDED_BY ,
    OAUDIT.STTN_CD_AMENDED ,
    OAUDIT.STTN_THROUGH_RTG ,
    OAUDIT.STTN_EQPT_LOADED ,
    OAUDIT.STTN_EQPT_SOURCE ,
    OAUDIT.STTN_COS_MAN_IND ,
    OAUDIT.STTN_CUST_SITE_ID,
    CURRENT TIMESTAMP)
    ;

    When i update the source table through application mu update trigger is writing multiple rows in audit table. Could anyone let me know the reason why it is writing multple records.

    Thanks in Advance!!!

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What DB2 version and OS are you using? What is the UPDATE statement you are using? What are the rows being entered by the trigger?

    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •