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.