title: Can't call stored procedure in Java
body: <p>I write a <code>stored procedure</code> in <code>PostgreSQL</code>. I try to use, this procedure in java, it throw '<code>org.postgresql.util.PSQLException: ERROR: cursor " &lt; unnamed portal 1  &gt; " does not exist</code>' exception.</p>
  
  <p>procedure:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION subject_show(session_id CHARACTER VARYING,OUT result_cursor refcursor, OUT total_record INTEGER, OUT total_search_record INTEGER  ) AS $$
          BEGIN
              total_record:=23;
              total_search_record:=22;
              OPEN result_cursor FOR SELECT "ID","NAME"   FROM "SUBJECTS" ;
      END;
      $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>Call procedure, in <code>java</code> : </p>
  
  <pre><code>...
  
  callableStatement = conn.prepareCall("{ call subject_show(?,?,?,?) }");
  callableStatement.setString(1, sessionID);
  callableStatement.registerOutParameter(2, Types.REF);
  callableStatement.registerOutParameter(3, Types.INTEGER);
  callableStatement.registerOutParameter(4, Types.INTEGER);
  callableStatement.executeUpdate();
  System.out.println(callableStatement.getObject(3));
  System.out.println(callableStatement.getObject(4));
  rs = (ResultSet) callableStatement.getObject(2);
  ...
  </code></pre>