Re: Out parameters for functions.

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: robert(dot)zenz(at)sibvisions(dot)com
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Out parameters for functions.
Date: 2018-09-20 13:10:23
Message-ID: CADK3HHJH3Sajge8UHsQfa8LDycQMvOOjK05YDkkzHoDMUMcJ0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Robert,

Based on the test cases in the code this is how it works.

How does one register the out parameters in other drivers ?

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On Wed, 19 Sep 2018 at 10:43, Robert Zenz <robert(dot)zenz(at)sibvisions(dot)com>
wrote:

> Hello everybody.
>
> We've recently had to use functions which used OUT parameters and we are a
> little bit confused regarding the handling of such. In other JDBC drivers
> one
> does simply register the OUT parameter at the appropriate position in the
> parameter list. However, with the PostgreSQL JDBC driver we had to skip the
> registration of the OUT parameter altogether, the return value for the OUT
> parameter is then returned *after* all other parameters.
>
> Example, there is function which does accept three parameters:
>
> 1. IN numeric
> 2. OUT varchar
> 3. INOUT timezone
>
> When calling this function we have to do the following:
>
> CallableStatement statement = connection.prepareCall("{ ? = call
> test(?, ?) }");
> statement.registerOutParameter(1, Types.NUMERIC); // Return value.
> statement.setObject(2, value); // IN numeric
> statement.setObject(3, value); // INOUT timezone
>
> statement.execute();
>
> statement.getObject(4); // OUT varchar
>
> This is a little bit confusing at first, is that intended to behave as
> such?

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message pradeep puppala 2018-09-25 14:27:37 Query related to jdbc 42.2.5 version
Previous Message Davis, James A. (LARC-D318)[LITES II] 2018-09-20 12:48:16 Re: ssl connection issues