Tags: cobol, concern, database, db2, default, doens, emulator, error, exec, insert, mysql, oracle, orders, sql, timestamp, type, update

insert/update with default timestamp

On Database » DB2

3,059 words with 5 Comments; publish: Fri, 07 Dec 2007 18:35:00 GMT; (250140.87, « »)

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

All Comments

Leave a comment...

  • 5 Comments
    • Because of incorrect syntax,

      ...CURRENT-TIMESTAMP ,

      #1; Tue, 11 Dec 2007 18:19:00 GMT
    • 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

      #2; Tue, 11 Dec 2007 18:20:00 GMT
    • 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.

      #3; Tue, 11 Dec 2007 18:21:00 GMT
    • Thanks a lot :beer: :beer:

      It's time for me to going bed, It's 11:00 PM in France.

      Cheers

      #4; Tue, 11 Dec 2007 18:22:00 GMT
    • It works fine with CURRENT_TIMESTAMP without the ':' ;)
      #5; Tue, 11 Dec 2007 18:23:00 GMT