In order to use H2 database in our Junit tests instead of calling Oracle, I am blocked on creating aliases on H2 to emulate some Oracle compatibility :
I first declared an alias for to_char for date to char conversion : works fine
create alias TO_CHAR as $$ java.lang.String toChar(java.util.Date date, String format) throws Exception{ ... }$$;
Then I try to declare an alias for to_char for number to char conversion : now h2 doesn't accept it :
create alias TO_CHAR as $$ java.lang.String toChar(java.lang.Number value){ ... }$$;
It is rejected with the following error message :
org.h2.jdbc.JdbcSQLException: Function alias "TO_CHAR" already exists; SQL statement: create alias TO_CHAR as $$
java.lang.String toChar(java.lang.Number value){ return java.lang.String .valueOf(value); }$$
I also tried to declare the 2 functions in 1 block, like :
create alias TO_CHAR as $$
java.lang.String toChar(int value){ ... }
java.lang.String toChar(java.util.Date date, String format) throws Exception{ ... } $$;
In this case, there are no errors, but only the firest method declared is taken in account.
So, is there any way to declare 2 aliases having the same name but not the same signature ?