Hi,
I created and executed following Oracle procedure, I am using Oracle 10g.
CREATE OR REPLACE PROCEDURE emp_info (emp_ref_cursor01 OUT SYS_REFCURSOR)
IS
BEGIN
OPEN emp_ref_cursor02 FOR
SELECT empno, lastname, salary FROM EMPLOYEE;
END;
/
I am invoking the above procedure in my
java code using
JDBC CallableStatement
CallableStatement cStmt = conn.prepareCall("begin emp_info(?); end;");
cStmt.registerOutParameter(1, OracleTypes.CURSOR);
After this i wrote,
boolean executed = cStmt.execute();
System.out.println(executed);
ResultSet rs= cStmt.getResultSet();
and the value of executed is FALSE & the resultset rs is NULL.
However when I use the following
ResultSet rset = (ResultSet) cStmt.getObject(1);
I get the resultset object and can even iterate over it and get the desired results.
Why is the execute() not returning me the resultset?