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: Re: passing parameters to function
Date: Wed, 9 Nov 2005 09:14:18 +0530
Message-ID: <010501c5e4df$dd1f67b0$851e010a@NBINDIAXP0133> (raw)
References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133>
	<08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com>

Hi All, 

Is there anyway i can get the list of parameters which the store proc accepts from the java end after i make the prepareCall.

Thks

  ----- Original Message ----- 
  From: Dave Cramer 
  To: Srivats 
  Cc: pgsql-jdbc@postgresql.org 
  Sent: Tuesday, November 08, 2005 9:21 PM
  Subject: Re: [JDBC] passing parameters to function 


  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

view thread (5+ messages)  latest in thread

Message-ID: <010501c5e4df$dd1f67b0$851e010a@NBINDIAXP0133>
Permalink:  ../010501c5e4df$dd1f67b0$851e010a@NBINDIAXP0133/
Also on:    postgresql.org/message-id/010501c5e4df$dd1f67b0$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: <010501c5e4df$dd1f67b0$851e010a@NBINDIAXP0133>
  References: <005901c5e460$6273d980$851e010a@NBINDIAXP0133> <08F64608-CC33-4347-8CC4-31C0D3A469DF@fastcrypt.com> <010501c5e4df$dd1f67b0$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