title: Get ResultSet from Stored Procedure in Oracle from Java
body: <p>I've been looking through many posts in the forum related to my problem but I nothing helped me, so I'm posting my problem.
    I have a SP in Oracle (11g) that is suppossed to return a Result Set. The SP looks like follows:</p>
  
  <pre><code>CREATE OR REPLACE
  PROCEDURE testProc
  (
    tableName IN VARCHAR2,
    INFORMATION OUT SYS_REFCURSOR
  ) AS 
    sqlQuery varchar2(1000);
  BEGIN
    sqlQuery := 'SELECT ID||''|''||Name||''|''||Surname FROM '||tableName;
    OPEN INFORMATION FOR sqlQuery;
  END GETVALIDATIONPECLOG;
  </code></pre>
  
  <p>And the way I'm calling it from java is</p>
  
  <pre><code>...
  CallableStatement cs = null 
  cs = connection.prepareCall("{call getvalidationpeclog(?,?)}");
  cs.setString(1, table);
  cs.registerOutParameter(2, OracleTypes.CURSOR);
  System.out.println("AS: " + cs.execute()); //Returns false
  rs = (ResultSet) cs.getObject(2);
  while (rs.next()) {
     bw.write(rs.getString(1));
     bw.newLine();
  }
  ...
  </code></pre>
  
  <p>but guess what? It doesn't work at all... What am I missing? Thanks !</p>