title: H2 database and functions in separate schemas
body: <p>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.</p>
  
  <p>However I've got a problem with translating oracle construction:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>which I'm calling with:</p>
  
  <pre><code>select permission_tools.get_access_level(?, ?) from dual;
  </code></pre>
  
  <p>into H2 equivalent. I've been trying something like:</p>
  
  <p>CREATE SCHEMA PERMISSION_TOOLS;</p>
  
  <pre><code>CREATE ALIAS PERMISSION_TOOLS.GET_ACCESS_LEVEL as $$
  String nextPrime(String value) {
      return new BigInteger(value).nextProbablePrime().toString();
  }
  $$;
  </code></pre>
  
  <p>But this gives me compilation error:</p>
  
  <pre><code>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]
  </code></pre>
  
  <p>This does not give any clue as to was is going on here.</p>
  
  <p>Any help appreciated.</p>