From: Dave Cramer <pg@fastcrypt.com>
To: Srivats <scshekaran@riskspan.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: passing parameters to function
Date: Tue, 8 Nov 2005 10:51:08 -0500
Message-ID: <08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com> (raw)
In-Reply-To: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>
References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>
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
>
>
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, scshekaran@riskspan.com
Subject: Re: passing parameters to function
In-Reply-To: <08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com>
References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133> <08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox