Hi
I'm trying to create a test database (with H2 database). I'm using Oracle in production, and it seems nice to have oracle compatibility mode in h2.
However I've got a problem with translating oracle construction:
create or replace PACKAGE permission_tools IS
FUNCTION get_role_access_level(
p_role_id IN NUMBER,
p_permiss IN VARCHAR2)
RETURN NUMBER;
END permission_tools;
which I'm calling with:
select permission_tools.get_access_level(?, ?) from dual;
into H2 equivalent. I've been trying something like:
CREATE SCHEMA PERMISSION_TOOLS;
CREATE ALIAS PERMISSION_TOOLS.GET_ACCESS_LEVEL as $$
String nextPrime(String value) {
return new BigInteger(value).nextProbablePrime().toString();
}
$$;
But this gives me compilation error:
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "
CREATE ALIAS PERMISSION_TOOLS.[*]GET_ACCESS_LEVEL AS
String nextPrime(String value) {
return new BigInteger(value).nextProbablePrime().toString();
}
"; expected "FOR"; SQL statement:
CREATE ALIAS PERMISSION_TOOLS.GET_ACCESS_LEVEL as $$
String nextPrime(String value) {
return new BigInteger(value).nextProbablePrime().toString();
}
$$ [42001-131]
This does not give any clue as to was is going on here.
Any help appreciated.