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 » THE (SELECT ITEM.......

Post new topic  Reply to topic
 THE (SELECT ITEM....... « View previous topic :: View next topic » 
Author Message
ican.sbyn
PostPosted: Tue Mar 09, 2010 1:01 am    Post subject: THE (SELECT ITEM....... Reply with quote

Novice

Joined: 14 Jul 2009
Posts: 19

DearAll,
I want to fetch a particular value from Database based on a Timestamp field.
Select TransactionNumber from Database.LookUpTable where LookUpTime = TO_DATE(Somedate, 'MM/DD/YYYY HH24:MI:SS') -- This waht I want to do.

Why 'MM/DD/YYYY HH24:MI:SS' format is used: The reason is, in the Message broker 'Somedate' is comming like '12/18/2009 13:25:00' and in the database table, this value becomes '12/18/2009 1:25:00 PM'.

I am using the following code to make it work:
Code:

SET Environment.Var[] = PASSTHRU('SELECT TransactionNumber FROM LookUpTable  WHERE
IDNumber=? AND
 LookUpTime=TO_DATE(?, ''MM/DD/YYYY HH24:MI:SS'')'
 VALUES(IDNum ,
Somedate));
SET vIdTrn = Environment.Var.TransactionNumber ;


The code is working fine.

But I want to use "THE (SELECT ITEM......." clause. How the code will look like. Here the main challange is to append the Timestamp format.


Code:

SET vIdTrn = THE(SELECT ITEM L.TransactionNumber   FROM Database.{dbSchema}.LookUpTable AS B
WHERE B.IDNumber = IDNum ----  Is a Valid Query  BUT::::

SET vIdTrn = THE(SELECT ITEM L.TransactionNumber   FROM Database.{dbSchema}.LookUpTable AS B
WHERE B.IDNumber = IDNum AND
B.LookUpTime = TO_DATE(Somedate,'MM/DD/YYYY HH24:MI:SS')) --- Is not a VALID ESQL



Can any body please let me know the equivalent of the below incorrect ESQL query (Using 'THE (SELECT ITEM....)' :

SET vIdTrn = THE(SELECT ITEM L.TransactionNumber FROM Database.{dbSchema}.LookUpTable AS B
WHERE B.IDNumber = IDNum AND
B.LookUpTime = TO_DATE(Somedate,'MM/DD/YYYY HH24:MI:SS'))
Back to top
View user's profile Send private message
gs
PostPosted: Fri Mar 12, 2010 5:35 am    Post subject: Reply with quote

Master

Joined: 31 May 2007
Posts: 254
Location: Sweden

TO_DATE is a database function which can not be called directly.
Cast your string to a DATE type first using CAST(yourdate AS DATE FORMAT '<date format>')
Back to top
View user's profile Send private message
tanishka
PostPosted: Fri Nov 19, 2010 5:13 am    Post subject: Reply with quote

Centurion

Joined: 24 Nov 2008
Posts: 144

ican.sbyn,

I got same issue. Did you able to resolve this issue.
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 » THE (SELECT ITEM.......
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.