X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 504F6D71E0 for ; Tue, 8 Nov 2005 11:51:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31969-04 for ; Tue, 8 Nov 2005 15:51:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 4B8C6D715A for ; Tue, 8 Nov 2005 11:51:04 -0400 (AST) Received: (qmail 14402 invoked from network); 8 Nov 2005 15:51:10 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 8 Nov 2005 15:51:10 -0000 In-Reply-To: <005901c5e460$6273d980$851e010a@NBINDIAXP0133> References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133> Mime-Version: 1.0 (Apple Message framework v746.2) X-Priority: 3 Content-Type: multipart/alternative; boundary=Apple-Mail-14-686529977 Message-Id: <08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com> Cc: From: Dave Cramer Subject: Re: passing parameters to function Date: Tue, 8 Nov 2005 10:51:08 -0500 To: Srivats X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.023 required=5 tests=[AWL=0.022, HTML_MESSAGE=0.001] X-Spam-Score: 0.023 X-Spam-Level: X-Archive-Number: 200511/48 X-Sequence-Number: 14146 --Apple-Mail-14-686529977 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed You would have to set them to NULL Dave On 8-Nov-05, at 7:31 AM, Srivats wrote: > > Hi All, > > Suppose I have a store proc which accepts 4 input parameters > and I do a CallableStatement.setObject( 1, "..,,," ); > and execute the query . > > > CallableStatement functionCall = dbCon_.prepareCall("{call test1 > ( ?,?,?,?) }"); > functionCall.setObject( "param1","A10001" ); > functionCall.setObject( "param2","19830529" ); > functionCall.execute(); > Exception raised > > java.sql.SQLException: No value specified for parameter 3 > at com.mysql.jdbc.PreparedStatement.fillSendPacket > (PreparedStatement.java:1253) > at com.mysql.jdbc.PreparedStatement.fillSendPacket > (PreparedStatement.java:1201) > at com.mysql.jdbc.PreparedStatement.execute > (PreparedStatement.java:710) > at com.mysql.jdbc.CallableStatement.execute > (CallableStatement.java:520) > > > during runtime. Should i set the other 2 input parameters to null, > even when I dont want to pass these parameters to the SP. > In this statement call test1( ?,?,?,?), should the number of > parameters be the number > of parameters which the store procedure accepts or the number of > parameters that i want > to pass. How should this be done when my SP accepts 4 parameters > and i want to pass > only any two of them > > Thks > > PS: Looking for an early reply > > > > > > --Apple-Mail-14-686529977 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 You would have to set them to = NULL

Dave
On = 8-Nov-05, at 7:31 AM, Srivats wrote:

=A0
Hi All,
=A0
=A0
=A0


=A0=A0functionCall.setObject( "param2","19830529" = );
=A0
call = test1( ?,?,?,?), should the number of = parameters be the number
of parameters which the = store procedure accepts or the number of parameters that i = want
only any two of them
=A0
Thks
=A0
=A0
=A0
=A0
=A0
=A0


= --Apple-Mail-14-686529977--