ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Unable to cast to ESQL TIMESTAMP variable

Post new topic  Reply to topic
 Unable to cast to ESQL TIMESTAMP variable « View previous topic :: View next topic » 
Author Message
saurabh25281
PostPosted: Thu Dec 16, 2010 1:48 am    Post subject: Unable to cast to ESQL TIMESTAMP variable Reply with quote

Centurion

Joined: 05 Nov 2006
Posts: 108
Location: Bangalore

I am trying to get athe current timestamp from a DB2 database and store it to a ESQL TIMESTAMP variable, but the value is not populated.

The code does not throw any errors and i am able to see the value in the unique1 environment variable during debugging.

Is there any problem with the code?

DECLARE TEST_TS1 TIMESTAMP;

SET Environment.Variables.unique1 = PASSTHRU('SELECT current timestamp FROM SYSIBM.SYSDUMMY1');
SET TEST_TS1 = CAST (Environment.Variables.unique2 AS TIMESTAMP FORMAT ('yyyy-MM-dd HH:mm:ss.SSS'));
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
fatherjack
PostPosted: Thu Dec 16, 2010 2:02 am    Post subject: Re: Unable to cast to ESQL TIMESTAMP variable Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

saurabh25281 wrote:
Environment.Variables.unique2


Is this a typo or is it really your code ?
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
saurabh25281
PostPosted: Thu Dec 16, 2010 2:05 am    Post subject: Reply with quote

Centurion

Joined: 05 Nov 2006
Posts: 108
Location: Bangalore

Sorry typo...it should be unique1

Environment.Variables.unique1
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
good_bee
PostPosted: Thu Dec 16, 2010 2:39 am    Post subject: Reply with quote

Newbie

Joined: 15 Nov 2010
Posts: 5

Saurabh

I think you can only use FORMAT from BIT, BLOB or CHAR to TIMESTAMP and not from timestamp to timestamp.

Code:

You can specify a FORMAT parameter when casting:
From any of the string data types (BIT, BLOB, or CHARACTER) to:
DECIMAL
FLOAT
INTEGER
DATE
GMTTIMESTAMP
TIMESTAMP
GMTTIME
TIME
To any of the string data types (BIT, BLOB, or CHARACTER) from any of the numerical and date/time data types in the previous list.
Back to top
View user's profile Send private message
saurabh25281
PostPosted: Thu Dec 16, 2010 2:51 am    Post subject: Reply with quote

Centurion

Joined: 05 Nov 2006
Posts: 108
Location: Bangalore

I tried using CHARACTER instead of TIMESTAMP but for no use.

is it something related to ROWS being returned by the DB2 database which I am not handling.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
good_bee
PostPosted: Thu Dec 16, 2010 3:08 am    Post subject: Reply with quote

Newbie

Joined: 15 Nov 2010
Posts: 5

Saurabh

you can first CAST the timestamp that you had retrieved from DB2 into a string and then cast that String into timestamp of your required format.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Unable to cast to ESQL TIMESTAMP variable
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.