Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stored Procedure, Cursor and Java

4 views
Skip to first unread message

Matteo Franchini

unread,
Mar 8, 2005, 4:28:00 AM3/8/05
to
Hi all,
I've a problem in retrieving ResultSet from an Oracle Stored Procedure
with a Cursor as output parameter. There is a package that contains
the procedure and the cursor defintion.
As seen in many examples I tried the following code:

cstmt = conn.prepareCall("{? = call UDH."+nameProcedure+"( ? ) }");
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.setInt(2, param);
cstmt.execute();
rst = (ResultSet)cstmt.getObject(1);

where cstmt is a CallableStatement object and rst is a ResultSet.

The execute seems to work but when I try to set rst value Java throws
an exception with code ORA-00600.

I also tried the following statement cursor =
((OracleCallableStatement)cstmt).getCursor(1); but an invalid cast
exception has occured.

I try the code on an Oracle 9.2.0.1.0 and the jdk version is 1.5.

The stored procedure code is:
PROCEDURE OPEN_ONE_CURSOR ( IO_CURSOR OUT RCSET, idsite IN NUMBER)
AS
BEGIN
OPEN IO_CURSOR FOR
SELECT *
FROM UDH_SERVER
WHERE site_id = idsite;
END OPEN_ONE_CURSOR;

and the cursor defintion in the package is: type RCSET IS REF CURSOR;

What's wrong???
Thanks a lot to everyone who can help me!!!
Matteo

0 new messages