pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Srivats <scshekaran@riskspan.com>
To: pgsql-jdbc@postgresql.org
Subject: passing parameters to function
Date: Tue, 8 Nov 2005 18:01:46 +0530
Message-ID: <005901c5e460$6273d980$851e010a@NBINDIAXP0133> (raw)


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

view thread (5+ messages)  latest in thread

Message-ID: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>
Permalink:  ../005901c5e460$6273d980$851e010a@NBINDIAXP0133/
Also on:    postgresql.org/message-id/005901c5e460$6273d980$851e010a@NBINDIAXP0133

 · 

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: scshekaran@riskspan.com
  Subject: Re: passing parameters to function
  In-Reply-To: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>
  References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>

* 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