dbTalk Databases Forums  

Stored Procedure, Cursor and Java

comp.database.oracle comp.database.oracle


Discuss Stored Procedure, Cursor and Java in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matteo Franchini
 
Posts: n/a

Default Stored Procedure, Cursor and Java - 03-08-2005 , 03:28 AM






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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.