Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Java ResultSet from PL/SQL Output?
"May Nine" wrote...
> My question is, what kind of Oracle object do I have
> my PL/SQL proc return so that CallableStatement.getResultSet()
> will work?
Perhaps some other types can work as well nowadays, but I have previously made it work with a CURSOR.
One (slimmed) example that have worked for me:
TYPE MyType IS REF CURSOR RETURN students%ROWTYPE;
PROCEDURE MyProc1 (o_studCur OUT MyType); ...
CallableStatement cstmt
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.execute();
ResultSet rset =
((OracleCallableStatement)cstmt).getCursor(1);
There are some issues about it however.
Different drivers works differently, as it does'nt even work with all JDBC-drivers. How it works with the different drivers is also depending on which version of the Oracle database you are using...
My example above was made with Oracle's driver.
I've never tried WebLogic's driver, but I think that one doesn't need the explicit typecast. Then again I think I've seen something about a bug in it with Oracle on a Solaris operating system.
A lot of "ifs"...
// Bjorn A Received on Sat May 31 2003 - 04:09:44 CDT