When running CREATE SQL Query as below from a ".sql" file , Syntax error is
thrown,. However if i run the same sql on the console it runs fine.
create alias TO_DATE as $$
java.util.Date toDate(String s,String format) throws Exception {
return new java.text.SimpleDateFormat("yyyy.MM.dd").parse(s);}
$$;
create alias TO_DATE as [*]$$ java.util.Date toDate(String s,String format)
throws Exception { return new
java.text.SimpleDateFormat(""yyyy.MM.dd"").parse(s)" [42000-177]
at org.h2.message.DbException.getSyntaxError(DbException.java:190)
if i change this query to below in .sql file :
create alias TO_DATE as '$$'
java.util.Date toDate(String s,String format) throws Exception {
return new java.text.SimpleDateFormat("yyyy.MM.dd").parse(s);}
'$$';
It throws an error :
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement
"create alias TO_DATE as '$$' java.util.Date toDate(String s,String format)
throws Exception { return new
java.text.SimpleDateFormat(""yyyy.MM.dd"").parse(s[*])" [42000-177]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
Whats the issue here and how to resolve it ?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.