Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    26

    Unanswered: symbol in trigger definition

    Hi,
    I found a symbol like '--' in below mentioned trigger

    CREATE TRIGGER RQ5.CNTRL_LST_UPDT
    AFTER UPDATE OF UPDT_DT ON RQ5.CNTRL_LST_ITM
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW MODE DB2SQL
    WHEN (NEW.CNTRL_LST_ID < 1000)
    BEGIN ATOMIC
    INSERT INTO RQ5.CNTRL_LST_ITM_HIST(CNTRL_LST_ID,ITM_ID,HIST_TM STMP,HIST_REAS_TYP,AGE,DECD,
    ENTRED_DT,UPDT_DT,AS_OF_DT,DOB,LST_NM,FRST_NM,CATG _ID,TITL,POSN,PLACE_OF_BTH,EDITOR,SBS_SCOR_VAL)
    VALUES(OLD.CNTRL_LST_ID,OLD.ITM_ID,CURRENT TIMESTAMP,'CC',OLD.AGE,OLD.DECD,OLD.ENTRED_DT,
    OLD.UPDT_DT,OLD.AS_OF_DT,OLD.DOB,OLD.LST_NM,OLD.FR ST_NM,OLD.CATG_ID,OLD.TITL,OLD.POSN,OLD.PLACE_OF_B TH,
    OLD.EDITOR,OLD.SBS_SCOR_VAL);--
    INSERT INTO RQ5.CNTRL_LST_ITM_ADNL_INFO_HIST(CNTRL_LST_ID,ITM_ ID,HIST_TMSTMP,ADNL_INFO_TYP,SEQ_ID, ADNL_INFO)
    SELECT B.CNTRL_LST_ID,B.ITM_ID,CURRENT TIMESTAMP,B.ADNL_INFO_TYP,B.SEQ_ID,B.ADNL_INFO
    FROM RQ5.CNTRL_LST_ITM_ADNL_INFO B WHERE B.CNTRL_LST_ID = OLD.CNTRL_LST_ID AND B.ITM_ID = OLD.ITM_ID;--
    INSERT INTO RQ5.CNTRL_LST_ITM_SRC_HIST(CNTRL_LST_ID,ITM_ID,HIS T_TMSTMP,SRC_ID,SRC_NM_EN,SRC_NM_FR)
    SELECT B.CNTRL_LST_ID,B.ITM_ID,CURRENT TIMESTAMP,B.SRC_ID,D.SRC_NM_EN,D.SRC_NM_FR
    FROM RQ5.CNTRL_LST_ITM_SRC B INNER JOIN RQ5.SRC D ON B.SRC_ID = D.SRC_ID
    WHERE B.CNTRL_LST_ID = OLD.CNTRL_LST_ID AND B.ITM_ID = OLD.ITM_ID;--
    END

    So far I know this symbol is being used in PL/SQL to comment out a line, but What is the siginficant of this symbol in trigger.

    Thanks
    Surjya

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Anything after it on the same line is considered a comment and ignored.

    Andy

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    The comment is a trick so that DB2 will not interpret the ';' as statement terminator. Otherwise, if you us ';' as statement terminator, the nested ';' would be interpreted as the terminator for the CREATE TRIGGER statement and the statement would obviously fail with a syntax error.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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