We already have a CHAR function, and you can't override built-in functions.
We should probably be throwing an error at the CREATE ALIAS command.
On 2012-12-24 22:42,
fadi....@gmail.com wrote:
> Hi, I'm trying to unit test some legacy DB2 style SQLs, the issue I'm
> facing is that my H2 user defined function SQL:
>
> CREATE ALIAS CHAR FOR "com.and.play.h2.Functions.charfromdate";
>
> and Java:
>
> public class Functions {
>
> public static String charfromdate(Object ts, Object s){
> return "done";
> }
> }
> is not working with DB2 syntax :
>
> CHAR(cast(CVW.CTORGANS_DATE as date), ISO)
>
> And I'm getting this exception:
> Caused by: org.h2.jdbc.JdbcSQLException: Invalid parameter count for
> "CHAR", expected count: "1"; SQL statement:
>
> which means that my function is not taking effect, any Ides?
>
> Regards
> --
> You received this message because you are subscribed to the Google
> Groups "H2 Database" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/h2-database/-/RFD_Zxf0HsYJ.
> To post to this group, send email to
h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
>
h2-database...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/h2-database?hl=en.