Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JBDC refcursor problem with Oracle

Status
Not open for further replies.

patnim17

Programmer
Jun 19, 2005
111
US
Hi,
I have a Stored Procedure that has one of the parameters as ref Cursor. When I call the stored procedure from Java using JDBC..I get the cursor into a resultset object like this:

rs = (ResultSet)objStmt.getObject(iCurPos);

where rs is a ResultSet, objStmt is a CallableStatement, and iCurPos is the ref cursor position in the stored procedure.

Now, the problem is when the cursor is not opened at all, which is very much possible, then I get a Invalid ref Cursor Error raised by Oracle..

How can I handle this situation, so that I have a Empty record Set in rs ( 0 records) in case of this situation?


pat
 
You may handle this issue on Oracle side: istead of not opening a cursor you may open it for some dummy statement like <your original query .. and 1=0>. Another way is to catch that error and process it gracefully.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top