ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apinke <apinkelef...@gmail.com>
Subject Re: DB2 & Ibatis:problem creating WHERE clause with CURRENT_TIMESTAMP
Date Thu, 28 Feb 2008 05:22:55 GMT


That worked .

Thanks a lot !!

Pat


Larry Meadors wrote:
> 
> Since you scrub the input by doing this:
> 
> params.put("duration",new Integer(duration));
> 
> You are pretty safe to do this:
> 
> where (INSERTTIME >= CURRENT_TIMESTAMP  -  $duration$  MINUTES)
> 
> That'll work.
> 
> Larry
> 
> 
> On Wed, Feb 27, 2008 at 2:18 AM, apinke <apinkelefant@gmail.com> wrote:
>>
>>  Hi All,
>>
>>  I am using DB2 with IBatis and facing a problem in creating a where
>>  condition which uses CURRENT_TIMESTAMP
>>  The SQL that works  :
>>  Select sum(TOTAL),code  from ORDER_DATA
>>  where (INSERTTIME >= CURRENT_TIMESTAMP - 30 MINUTES)
>>  group by code
>>
>>  I am trying to parametrize the value in minutes.
>>
>>  I tired this :
>>  params.put("duration",new Integer(duration));
>>  ...
>>  where (INSERTTIME >= CURRENT_TIMESTAMP  -  #duration#  MINUTES)
>>
>>  but that did not work .Got a DB2 invalid sql error
>>  I then tried
>>
>>  params.put("duration_string","CURRENT_TIMESTAMP -  30 MINUTES");
>>  ...
>>  where (INSERTTIME >= #duration_string# )
>>
>>  But this throws a "error occurred while applying a parameter map.
>> Date/Time
>>  must be JDBC format"
>>  which is as expected
>>
>>  Any suggestions on how can I pass then duration to the query ?
>>
>>  thanks
>>  Pat
>>
>>
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/DB2---Ibatis%3Aproblem-creating-WHERE-clause-with-CURRENT_TIMESTAMP-tp15709225p15709225.html
>>  Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/DB2---Ibatis%3Aproblem-creating-WHERE-clause-with-CURRENT_TIMESTAMP-tp15709225p15729984.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message