50004-162 error in prepared statement

32 views
Skip to first unread message

Sergey Sachkov

unread,
Feb 2, 2012, 9:37:04 AM2/2/12
to H2 Database
Hi,

I have error 50004-162 in prepared statement here it is:

update test set user=?, expires=sysdate + ?, name=?,
last_modified=sysdate where test= ?

as I understood error appeares because of expires=sysdate + ?
statment. Are there any way to make it work like it is now?

Thanks in advance,
Regards,
Sergey

Peter Yuill

unread,
Feb 2, 2012, 4:52:14 PM2/2/12
to h2-da...@googlegroups.com
Hi Sergey,

> I have error 50004-162 in prepared statement here it is:
>
> update test set user=?, expires=sysdate + ?, name=?,
> last_modified=sysdate where test= ?
>
> as I understood error appeares because of expires=sysdate + ?
> statment. Are there any way to make it work like it is now?

You could try DATEADD() eg

update test set user=?, expires=DATEADD('DAY', ?, sysdate), name=?,
last_modified=sysdate where test= ?

Regards,
Peter

Sergey Sachkov

unread,
Feb 3, 2012, 3:23:18 AM2/3/12
to h2-da...@googlegroups.com
Hi Peter,

Thank you for your reply.

 I use H2 DB for functional tests, with app that use Oracle DB and JDBC in Java, so it has queries that I wouldn't like to change. For now I did changed the code to calculate the date in java and just put it as parameter. But for the future I think that it would be good to support this behaivour in Oracle mode.

Thanks,
Regards,
Sergey
Reply all
Reply to author
Forward
0 new messages