Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling Remote DB Stored Procedure which returns Ref Cursor  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
Good Afternoon.
I have a problem related to accessing a remoted database stored procedure which returns cursor. I am accessing stored procedures from my local DB which returns ref cursor. There is no problem with local DB procedures and I am able to read the data from cursor.
But In case of remote DB, I am not able to read the data. I am able to make a call to remote DB stored procedure. The return value is also valid and able to type cast to ResultSet type. I checked the ResultSetMetaData also on type casted ResultSet object. The column names from ResultSetMetaData object are correct.

The major problem is when I try to read the data from ResultSet. I am getting the Exception, "java.sql.SQLException: ORA-24338: statement handle not executed".

The stack trace of that Exception is as follows.

java.sql.SQLException: ORA-24338: statement handle not executed
at oracle.jdbc.driver.DatabaseError.throwSqlException(
at oracle.jdbc.driver.T4CTTIoer.processError(
at oracle.jdbc.driver.T4CTTIoer.processError(
at oracle.jdbc.driver.T4C8Oall.receive(
at oracle.jdbc.driver.T4CStatement.doOall8(
at oracle.jdbc.driver.T4CStatement.fetch(
at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(

Please note that the same stored procedure is created in local DB also. When I execute this, I am able to read the Data from ResultSet.

When I go through the concept of ref cursors in PL/SQL documentation, I read some where that the memory reference is given/returned in case of ref cursor.
Is my current problem is because of remote DB or something else? I could not locate the actual issue.

Please somebody look into this and give some suggessions. Awaiting for your valuable suggessions.

Thanks in advance.

Best Regards,
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!