Hello,
I need to be able to execute MySQL statements on H2 for my unit tests.
And I'm blocked by the DATE_ADD(...) function.
I tried to define my own function in Java like this:
public class H2Functions {
public static Date dateAdd(Date date, String expr) {
...
}
}
CREATE ALIAS DATE_ADD FOR "H2Functions.dateAdd";
SELECT DATE_ADD(now(), INTERVAL 1 DAY);
Syntax error in SQL statement "SELECT DATE_ADD(NOW(), INTERVAL 1[*]
DAY) "; expected "., (, [, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE,
REGEXP, IS, IN, BETWEEN, AND, OR, ), ,"; SQL statement:
SELECT DATE_ADD(now(), INTERVAL 1 DAY) [42001-164] 42001/42001
I understand that INTERVAL 1 DAY is not a string, and so my function
is not called.
Is there a mean to have a SQL request with DATE_ADD which works on
both H2 and MySQL?
Thanks.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.