Hi Jochen,

The String constructor for Date was deprecated long ago. You really need to use DateFormat.parse().

Try:

create or replace alias hts.test1 AS $$
java.util.Date bub(String s){
return new java.text.SimpleDateFormat("dd-MMM-yy").parse(s);
}
$$


Regards,
Peter
Hello everybody,

i am trying to create the following function:

create or replace alias hts.test1 AS $$
java.util.Date bub(String s, String b){
return new java.util.Date(new java.text.SimpleDateFormat("dd-MMM-
yy",new java.util.Locale("en","US")).format(new java.util.Date(s)));
}
$$

But H2 raises the following error:

org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "Note: org/
h2/dynamic/TEST1.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
"
Syntax error in SQL statement "Note: org/h2/dynamic/TEST1.java uses or
overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
"; SQL statement:
create or replace alias hts.test1 AS $$
java.util.Date bub(String s, String b){
return new java.util.Date(new java.text.SimpleDateFormat("dd-MMM-
yy",new java.util.Locale("en","US")).format(new java.util.Date(s)));
}
$$ [42000-154]

I don't know how to fix it.

Have anyone an idea?

Greetz

Jochen Schreiber


--
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.

Reply via email to