If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > insert/update with default timestamp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-12-06, 11:02
fab01 fab01 is offline
Registered User
 
Join Date: Mar 2006
Posts: 17
Red face 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
Reply With Quote
  #2 (permalink)  
Old 05-12-06, 11:21
akkm akkm is offline
Registered User
 
Join Date: Oct 2004
Posts: 7
Because of incorrect syntax,

....CURRENT-TIMESTAMP ,
Reply With Quote
  #3 (permalink)  
Old 05-12-06, 14:35
fab01 fab01 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 05-12-06, 15:05
umayer umayer is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 05-12-06, 17:01
fab01 fab01 is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 05-15-06, 05:03
fab01 fab01 is offline
Registered User
 
Join Date: Mar 2006
Posts: 17
It works fine with CURRENT_TIMESTAMP without the ':'
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On