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 » IS Comparison operator not allowed in SQL statement?

Post new topic  Reply to topic
 IS Comparison operator not allowed in SQL statement? « View previous topic :: View next topic » 
Author Message
Siddu
PostPosted: Thu Nov 22, 2012 8:21 am    Post subject: IS Comparison operator not allowed in SQL statement? Reply with quote

Apprentice

Joined: 22 Aug 2012
Posts: 44

Hi All,
I'm trying to access the SQL database records which are modified during particular amont of period.

My query looks something like this:

SET INTERVAL1 = CURRENT_TIMESTAMP - LastRun ;
SET Environment.XMLNSC.Results[] = (SELECT T.* FROM DSNNAME.DBSCHEMA1.DBTABLE1 AS T where TIMESTAMP > INTERVAL1);

This is saying SYNTAX error.
Both LastRun and INTERVAL1 are DATE types.

Can you please let me know where I'm wrong?

Thanks & Regards
Siddu

_________________
"Be honest. It is one of the few things that you can control in your life."
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 22, 2012 9:19 pm    Post subject: Re: IS Comparison operator not allowed in SQL statement? Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Siddu wrote:

SET INTERVAL1 = CURRENT_TIMESTAMP - LastRun ;

From memory you need to set the interval type. Look at the examples in the infocenter...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Thu Nov 22, 2012 9:26 pm    Post subject: Re: IS Comparison operator not allowed in SQL statement? Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Siddu wrote:

Can you please let me know where I'm wrong?

Siddu wrote:

Both LastRun and INTERVAL1 are DATE types.


I think this is also one of the reasons. They should be of TIMESTAMP datatypes. Also you can use the option of INTERVAL.

Check these links for reference,

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac16750_.htm
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac05950_.htm
Back to top
View user's profile Send private message Send e-mail
Siddu
PostPosted: Thu Nov 22, 2012 10:37 pm    Post subject: Re: IS Comparison operator not allowed in SQL statement? Reply with quote

Apprentice

Joined: 22 Aug 2012
Posts: 44

kash3338 wrote:
Siddu wrote:

Can you please let me know where I'm wrong?

Siddu wrote:

Both LastRun and INTERVAL1 are DATE types.


I think this is also one of the reasons. They should be of TIMESTAMP datatypes. Also you can use the option of INTERVAL.

Check these links for reference,

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac16750_.htm
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac05950_.htm


Hi Kash,
Thanks for your reply.
I modified the type to INTERVAL.
DECLARE INTERVAL1 INTERVAL;
SET Environment.start_Time = CURRENT_TIMESTAMP;
SET Environment.lastSuccessfulQuery = InputRoot.XMLNSC.PPGEvent.LastSuccessfullRun;
SET INTERVAL1 = (Environment.start_Time-Environment.lastSuccessfulQuery);
SET Environment.XMLNSC.Result.AppAudit1[] = ( SELECT T.* FROM Database.{DSNNAME2}.{DBSCHEMA2}.{DBTABLE2} AS T WHERE TIMESTAMP > INTERVAL1);

But still getting the same error.

Is there anything wrong with using operator '>' in the SQL statement?
_________________
"Be honest. It is one of the few things that you can control in your life."
Back to top
View user's profile Send private message
kash3338
PostPosted: Thu Nov 22, 2012 10:43 pm    Post subject: Re: IS Comparison operator not allowed in SQL statement? Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Siddu wrote:
Is there anything wrong with using operator '>' in the SQL statement?


Please refer the links for the usage and purpose of INTERVAL type and you need to modify your code accordingly.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac16750_.htm
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac05950_.htm

Look for samples on using this and change your code accordingly. The current code is incorrect for the usage of INTERVAL.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IS Comparison operator not allowed in SQL statement?
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.