Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Syntax of setting Ref Cursor in procedure from JDBC

Syntax of setting Ref Cursor in procedure from JDBC

From: Atul <soni.atul_at_gmail.com>
Date: 28 Nov 2004 05:22:08 -0800
Message-ID: <a8547532.0411280522.2df2e17b@posting.google.com>


Hi,

I am calling a SP from java. Now the problem is that the SP has 3 Parameters- :

2 IN String variables
1 IN OUT variable which is a REF CURSOR

Java Code

String cmrQuery="{call cust_db.get_cntr_num_sp(?,?,?)}"; <<--IS SYNTAX CORRECT

cstmt = con.prepareCall(cmrQuery);                               
cstmt.setQueryTimeout(QUERY_TIMEOUT) ;                           
cstmt.setString(1,mcn_base);                                     
cstmt.setString(2,mcn_sfx);                                      
cstmt.setString(3,NULL); <<-- PROBLEM IS HERE cstmt.registerOutParameter(1, OracleTypes.CURSOR); rs =cstmt.executeQuery();

SO now my question is -:

  1. Is the calling syntax correct of the SP with these 3 parameters ?
  2. While using setString() of IN OUT Ref Cursor what will be parameter?? ( i.e . will it be null or we can leave it empty? since we r not passing anything in the ref cursor and if we dont set it then it will say a variable not bound error.!!)

Any help or clarification will be highly helpful.. I have been banging my head on this one for some time now..

Thanks in advance
atul Received on Sun Nov 28 2004 - 07:22:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US