Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKnjZ-0000mw-QW for pgsql-jdbc@arkaria.postgresql.org; Thu, 30 Jul 2015 13:18:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKnjZ-00083g-1L for pgsql-jdbc@arkaria.postgresql.org; Thu, 30 Jul 2015 13:18:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKnjX-00083Q-71 for pgsql-jdbc@postgresql.org; Thu, 30 Jul 2015 13:18:51 +0000 Received: from mailfilter.ebaotech.com ([210.13.77.80] helo=esg.ebaotech.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKnjR-00073c-J7 for pgsql-jdbc@postgresql.org; Thu, 30 Jul 2015 13:18:50 +0000 Received: from shmbx02.ebaotech.com (unknown [172.16.31.104]) by Websense Email Security Gateway with ESMTPS id B3E09D7F804 for ; Thu, 30 Jul 2015 21:18:23 +0800 (CST) Received: from SHMBX01.ebaotech.com (172.16.31.103) by shmbx02.ebaotech.com (172.16.31.104) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 30 Jul 2015 21:18:37 +0800 Received: from SHMBX01.ebaotech.com ([::1]) by shmbx01.ebaotech.com ([fe80::d7c:997:6909:fc68%14]) with mapi id 15.00.0847.030; Thu, 30 Jul 2015 21:18:36 +0800 From: Alex Wang To: "pgsql-jdbc@postgresql.org" Subject: need advice about out parameter settings while calling stored procedure in Java code Thread-Topic: need advice about out parameter settings while calling stored procedure in Java code Thread-Index: AdDKyjkvIuHKHU/YQAqQRuA2IG4f9g== Date: Thu, 30 Jul 2015 13:18:35 +0000 Message-ID: <91b75bc23fbe41adba69c52ed4c2213f@shmbx01.ebaotech.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.18.50.66] Content-Type: multipart/alternative; boundary="_000_91b75bc23fbe41adba69c52ed4c2213fshmbx01ebaotechcom_" MIME-Version: 1.0 X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --_000_91b75bc23fbe41adba69c52ed4c2213fshmbx01ebaotechcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi , I am migrating from Oracle to Postgresql, and have encountered below issue = while calling stored procedure via the latest PG JDBC (postgresql-9.4-1201.= jdbc4.jar). Here is the procedure snippet: ----------start------------ PROCEDURE p_myprocedure(a character varying, b character varying, c charact= er varying,d character varying, OUT o1 text, OUT o2 text) IS BEGIN Blalabla; END; ----------end------------- In my Java code, I have to set the value of the out parameters like input a= s bellowing: stmt =3D con.prepareCall("{call xxx. p_myprocedure(?,?,?,?,?,?)}"); stmt.setString(1, "x1"); stmt.setString(2, "x21"); stmt.setString(3, "x3"); stmt.setString(4, "x4"); stmt.setString (5,"");//need to set the output value stmt.setString (6,""); //need to set the output value before invoking the 'stmt.execute();'; Otherwise, it will throw error like: ERROR: function p_myprocedure (character varying, character varying, charac= ter varying, character varying) does not exist Hint: No function matches the given name and argument types. You might ne= ed to add explicit type casts. But setting output is unnecessary if I use Oracle DB or access Postgresql = DB via EDB jdbc driver. Is there any possible way to avoid such out parameter settings ? Thanks & regards, Alex This e-mail and any attachments thereto are intended for the sole use of th= e recipient(s) named above and may contain confidential and/or privileged m= aterial. Any use of the information contained herein (including, but not li= mited to, total or partial reproduction, communication, or dissemination in= any form) by persons other than the intended recipient(s) is prohibited. I= f you received this in error, please contact the sender immediately and del= ete the material from any computer. --_000_91b75bc23fbe41adba69c52ed4c2213fshmbx01ebaotechcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi ,

 

I am migrating from Oracle to Postgresql, and have e= ncountered below issue while calling stored procedure via the latest PG JDB= C (postgresql-9.4-1201.jdbc4.jar).

 

Here is the procedure snippet:

 

----------start------------

 

PROCEDURE p_myprocedure(a character varying, b chara= cter varying, c character varying,d character varying, OUT o1 text, OUT o2 = text) IS

  BEGIN

 

Blalabla;

 

END;

 

----------end-------------

 

In my Java code, I have to set the value of the out = parameters like input as bellowing:

 

stmt =3D con.prepareCall("{call xxx. p_mypro= cedure(?,?,?,?,?,?)}&q= uot;);

       &nbs= p;          stmt.setString(1, "x1"<= /span>);

       &nbs= p;          stmt.setString(2, "x21"= );

       &nbs= p;          stmt.setString(3, "x3"<= /span>);

       &nbs= p;          stmt.setString(4, "x4"<= /span>);

       &nbs= p;          stmt.setString (5,"");//need to set the output value=

&= nbsp;           &nbs= p;     stmt.setString (6,""); //need to set the output value

before invoking the ‘stmt.execute();’;

 

Otherwise, it will throw error like:

 

ERROR: function p_myprocedure (character varying= , character varying, character varying, character varying) does not exist

&nb= sp; Hint: No function matches the given name and argument types. You might = need to add explicit type casts.

 

But setting output  is unnecessary if I use Ora= cle DB or access Postgresql DB via EDB jdbc driver.

 

Is there any possible way to avoid such out paramete= r settings ?

 

Thanks & regards,

 

Alex

 

This e-mail and any attachments thereto are intended for the sole use of th= e recipient(s) named above and may contain confidential and/or privileged m= aterial. Any use of the information contained herein (including, but not li= mited to, total or partial reproduction, communication, or dissemination in any form) by persons other than the int= ended recipient(s) is prohibited. If you received this in error, please con= tact the sender immediately and delete the material from any computer. --_000_91b75bc23fbe41adba69c52ed4c2213fshmbx01ebaotechcom_--