Home » Developer & Programmer » JDeveloper, Java & XML » JDBC Ref Cursor, Error message: Type Unknown
JDBC Ref Cursor, Error message: Type Unknown [message #91481] Tue, 01 October 2002 22:58 Go to next message
Ben
Messages: 48
Registered: January 2000
Member
I get error message "Type Unknown = -10" when executing the following JAVA. This occurs on the same line that I'm registering the output parameter. One thing that is different about this stored procedure from what oracle has documented for REF CURSOR is that I'm returning a custom cursor type 'mycursor'. As you can see in my call to the stored procedure I had to include a variable OUT_CURSOR in order to return results. Not sure if that is whats causing my problem.

String CCIDString = "DECLARE TYPE mycursor IS REF CURSOR; ";
CCIDString = CCIDString + "OUT_CURSOR mycursor; ";
CCIDString = CCIDString + "BEGIN APPS.SLINK.GLC_VALIDATE_CCID( ?, ?, OUT_CURSOR ); END;";

try{

cs = OracleCon.prepareCall(CCIDString);
cs.setString(1,sobID);
cs.setString(2,Segment);
cs.registerOutParameter(3, oracle.jdbc.OracleTypes.CURSOR); <-- error occurs here
cs.execute();

ResultSet rset = (ResultSet)cs.getObject(3);
while (rset.next ()){
Log.customer.debug("rset.getString(0): "+rset.getString(0));
}
Re: JDBC Ref Cursor, Error message: Type Unknown [message #91534 is a reply to message #91481] Thu, 24 October 2002 05:33 Go to previous message
Manoj
Messages: 101
Registered: August 2000
Senior Member
Use the following code

stmt1 = con.prepareCall("{call procedure_name(?,?,?,?)}");
stmt1.setString(1, param1);
stmt1.registerOutParameter(2, OracleTypes.CURSOR);
stmt1.registerOutParameter(3,java.sql.Types.VARCHAR);
stmt1.registerOutParameter(4,java.sql.Types.VARCHAR);
stmt1.execute();

ResultSet rs = ((OracleCallableStatement)stmt1).getCursor(1);

where out parameter in stored procedure is a ref cursor
for OracleTypes.CURSOR
This should work out

Manoj
Previous Topic: JSP Problem
Next Topic: Passing REF Cursor from Java to PLSQL as IN parameter
Goto Forum:
  


Current Time: Sat Jul 24 16:00:31 CDT 2021