h2 Add/Subtract Interval in Oracle query

536 views
Skip to first unread message

mdarf...@gmail.com

unread,
Jan 16, 2018, 10:05:02 PM1/16/18
to H2 Database
I have h2 database in server mode for my tests (oracle mode)

I can't add/subtract an interval to my date, in my spring-batch writer, when my request works in SQLDeveloper

How to do this whith h2
1) UPDATE MY_TABLE SET my_date = (sysdate - INTERVAL '1' SECOND);
2) UPDATE MY_TABLE SET my_date = (sysdate - NUMTODSINTERVAL(1, 'SECOND'));
3) UPDATE MY_TABLE SET my_date = (sysdate - TO_DSINTERVAL('0 00:00:01'));

Errors I met :

1) Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "UPDATE MY_TABLE SET my_date = sysdate - INTERVAL '1'[*] SECOND"; SQL statement:
UPDATE MY_TABLE SET MY_DATE = sysdate - INTERVAL '1' SECOND [42000-196]
2 )Caused by: org.h2.jdbc.JdbcSQLException: Function "NUMTODSINTERVAL" not found; SQL statement:
3) Caused by: org.h2.jdbc.JdbcSQLException: Function "TO_DSINTERVAL" not found; SQL statement:

Noel Grandin

unread,
Jan 17, 2018, 1:43:14 AM1/17/18
to h2-da...@googlegroups.com
sorry, we don't support those oracle functions​
Reply all
Reply to author
Forward
0 new messages