title: Calling PL/SQL procedure with SYS_REFCURSOR as IN parameter using JDBC
body: <p><strong>I am trying to understand how I can call a PL/SQL procedure which takes a <code>SYS_REFCURSOR</code> as <code>IN</code> parameter.</strong></p>
  
  <p>Consider the following PL/SQL procedure:</p>
  
  <pre><code>print_cursor_contents(myCursor SYS_REFCURSOR , row_count OUT NUMBER);
  </code></pre>
  
  <p>At the time of binding value to the IN parameter which <code>setXXX</code> method do I use ? </p>
  
  <p>To me a java Class with individual cursor record fields , as it members and a Array of instances of this class seems the proper way to represent a plsql CURSOR. I get a SQLException when I do this:</p>
  
  <p>I used the following set method</p>
  
  <pre><code>         callStmt.setObject(1, curRec);
  </code></pre>
  
  <p>Here is the exception I got for using the above statement:</p>
  
  <pre><code>Exception occured in the database
  Exception message: Invalid column type
  java.sql.SQLException: Invalid column type
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:8921)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8396)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:9176)
      at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:5024)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:234)
      at com.rolta.HrManager.printMaxSalAllDept(HrManager.java:1022)
      at com.rolta.HrManager.main(HrManager.java:1116)
  Database error code: 17004
  </code></pre>