Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    17

    Red face Unanswered: insert/update with default timestamp

    Hi why when i type these 2 sql orders,
    It doens' t work ? (the error concern,s the timestamp)
    (COBOL, Z/0S, emulator 3270, DB2 V7)
    EXEC SQL
    INSERT INTO
    TASNMEMO
    ( ASNMEMO_UG ,
    ASNMEMO_CIE ,
    ASNMEMO_NUMSIN ,
    ASNMEMO_SEQUENCE ,
    ASNMEMO_DATE_CR ,
    ASNMEMO_TITRE ,
    ASNMEMO_TEXTE ,
    ASNMEMO_TIMEST_WR ,
    ASNMEMO_USER_WR ,
    ASNMEMO_TIMEST_RW ,
    ASNMEMO_USER_RW
    )
    VALUES
    (:ASNMEMO-UG ,
    :ASNMEMO-CIE ,
    :ASNMEMO-NUMSIN ,
    :ASNMEMO-SEQUENCE ,
    :ASNMEMO-DATE-CR ,
    :ASNMEMO-TITRE ,
    :ASNMEMO-TEXTE ,
    CURRENT TIMESTAMP ,
    :ASNMEMO-USER-WR ,
    CURRENT-TIMESTAMP ,
    :ASNMEMO-USER-RW
    )
    END-EXEC
    EXEC SQL
    UPDATE
    TASNMEMO
    SET
    ASNMEMO_USER_RW = :ASNMEMO-USER-RW ,
    ASNMEMO_TIMEST_RW = CURENT TIMESTAMP ,
    ASNMEMO_TEXTE = :ASNMEMO-TEXTE
    WHERE
    ASNMEMO_UG = :ASNMEMO-UG AND
    ASNMEMO_CIE = :ASNMEMO-CIE AND
    ASNMEMO_NUMSIN = :ASNMEMO-NUMSIN
    END-EXEC

    Thanks for your help
    Cheers

  2. #2
    Join Date
    Oct 2004
    Posts
    7
    Because of incorrect syntax,

    ....CURRENT-TIMESTAMP ,

  3. #3
    Join Date
    Mar 2006
    Posts
    17
    thanks for your reply.
    A last question :
    should i consider that current-timestamp is a host variable or not ?
    I try to code this sentence and change current timestamp by current-timestamp but i think (if my memory is good that it doesnt work)
    BUT in spufi, it works.
    Are you really sure that replacing current timestamp by current-timestamp without the ':' caracter before current-timestamp works well ?
    I'm not in the office tomorrow and i would resolve this problem monday morning.
    thanks

  4. #4
    Join Date
    Dec 2005
    Posts
    273
    CURRENT-TIMESTAMP shouldn't work in DB2 for z/OS.

    Correct Syntax is CURRENT TIMESTAMP or CURRENT_TIMESTAMP ( both possible )

    In your 2nd example you coded CURENT TIMESTAMP instead of CURRENT.

  5. #5
    Join Date
    Mar 2006
    Posts
    17
    Thanks a lot
    It's time for me to going bed, It's 11:00 PM in France.
    Cheers

  6. #6
    Join Date
    Mar 2006
    Posts
    17
    It works fine with CURRENT_TIMESTAMP without the ':'

Posting Permissions

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