Re: DB2 scalar CHAR function vs H2 user defined functions.

104 views
Skip to first unread message

Noel Grandin

unread,
Jan 2, 2013, 9:44:30 AM1/2/13
to h2-da...@googlegroups.com, fadi....@gmail.com
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.

fadi....@gmail.com

unread,
Jan 7, 2013, 4:32:33 AM1/7/13
to h2-da...@googlegroups.com, fadi....@gmail.com
Ok, thanks, it would also be good to update "User-Defined Functions and Stored Procedures" documentation part with your answer/information.
Reply all
Reply to author
Forward
0 new messages