dbTalk Databases Forums  

Re: Java / Oracle Callable Statement with Null ResultSet

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss Re: Java / Oracle Callable Statement with Null ResultSet in the comp.databases.oracle.tools forum.



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

Default Re: Java / Oracle Callable Statement with Null ResultSet - 07-29-2003 , 01:33 AM







Hi Echohead,
I am also using the callable statement for the first time and getting
the basic errors like "Wrong number or Types of parameters in call to
<Procedure name>", tried everything but unable to get it corrected, can
you help me with the same.

Procedure is:

Create or Replace procedure DataSectionRows(id IN number, mydata OUT ref
cursor) as begin
open mydata for
Select * from table where id = 129 order by varname;
end;

and java code is same as you have mentioned.

Quick reply will be very very helpful,
thanks,


Originally posted by Echohead
Quote:
This is my first shot at a callablestatement, and have had some basic
problems (such as wrong number or type of parameters sent) getting
this to work. I think I have it working now, except for the fact that
my result set continues to be null, and there should be records. Can
anyone provide any insight into whether the following code is correct,
or, any changes I need to make?


// CODE SNIP
java.sql.Date d = new java.sql.Date(1994, 1, 1);

java.sql.Connection connX =
com.xxxx.XXXX.XXXX.DBODSConnection.getConnection(" DEVELOPMENT");

java.sql.CallableStatement callstmt = null;
callstmt = connX.prepareCall("begin ? := PKSTATETAX.GETSTATETAXLIST(?,
?); end;");

callstmt.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
callstmt.setString(2, "PT");
callstmt.setDate(3, d);

callstmt.execute();

java.sql.ResultSet rs2 = (java.sql.ResultSet) callstmt.getResultSet();

// QUICK TEST OF RESULTSET
if (rs2 == null) {out.println("RS null");}
else {
int iCount2 = 0;
while (cursor.next()) {
iCount2 = iCount2 + 1;
out.println(iCount2);
}
}

Thanks for your help.

--
Posted via http://dbforums.com


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.