title: Access Oracle SYS_REFCURSOR
body: <p>I'm kinda stuck here. I have a small stupid function in Oracle and try to access it with Java. The return value should be an SYS_REFCURSOR. But I get an error if I try to call it in Java.</p>
  
  <p>This is the Oracle function:</p>
  
  <pre><code>FUNCTION GET_TBL_AS_CUR
  RETURN SYS_REFCURSOR
  IS
    Tbl SYS_REFCURSOR;
  BEGIN
  
    OPEN Tbl FOR SELECT * FROM test_tbl;
    RETURN Tbl;
  
  END;
  </code></pre>
  
  <p>This is the Call in Java:</p>
  
  <pre><code>String stmt = "callStmt: {?= call dbschema.pkg_tbl_tools.get_tbl_as_cur()}";
  callableStatement = conn.prepareCall(stmt);
  callableStatement.registerOutParameter(1, OracleTypes.CURSOR);
  System.out.println("Executing... " + stmt + "\n");
  
  callableStatement.execute();
  
  rs = ((OracleCallableStatement)callableStatement).getCursor(1);
  
  } catch (Exception e) {
      System.out.println(e.getMessage());
  }
  </code></pre>
  
  <p>The error message is:</p>
  
  <pre><code>Unknown SQL-Type: sqlKind = UNINITIALIZED
  </code></pre>
  
  <p>What am I doing wrong??</p>