Author |
Message
|
Siddu |
Posted: Thu Nov 22, 2012 8:21 am Post subject: IS Comparison operator not allowed in SQL statement? |
|
|
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 |
|
 |
fjb_saper |
Posted: Thu Nov 22, 2012 9:19 pm Post subject: Re: IS Comparison operator not allowed in SQL statement? |
|
|
 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 |
|
 |
kash3338 |
Posted: Thu Nov 22, 2012 9:26 pm Post subject: Re: IS Comparison operator not allowed in SQL statement? |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
|
Back to top |
|
 |
Siddu |
Posted: Thu Nov 22, 2012 10:37 pm Post subject: Re: IS Comparison operator not allowed in SQL statement? |
|
|
Apprentice
Joined: 22 Aug 2012 Posts: 44
|
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 |
|
 |
kash3338 |
Posted: Thu Nov 22, 2012 10:43 pm Post subject: Re: IS Comparison operator not allowed in SQL statement? |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
|
Back to top |
|
 |
|