Re: [7.4.6] Calling PLpgSQL stored procedures with table row

From: Kris Jurka <books(at)ejurka(dot)com>
To: Eli Bingham <eli(at)savagebeast(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [7.4.6] Calling PLpgSQL stored procedures with table row
Date: 2004-12-15 23:37:12
Message-ID: Pine.BSO.4.56.0412151831020.741@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 15 Dec 2004, Eli Bingham wrote:

> In regards to the specific solution that you offer above with a
> function that creates row objects, would it be possible to invoke a
> composed function via a CallableStatement in Postgres JDBC, like this:
>
> CallableStatement proc = conn.prepareCall ("{ ? = call do_stuff
> (create_foobar (?, ?)) }");
> proc.registerOutParameter (1, Types.INTEGER);
> proc.setObject (2, x);
> proc.setObject (3, y);
>

Yes, this should work fine, behind the scenes the driver rewrites

{? = call func(?)}

into:

SELECT * FROM func(?);

So you should be able to test what a CallableStatement will do directly in
SQL.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Christine Warren 2004-12-16 13:44:57 Postgresql installation Errors
Previous Message Eli Bingham 2004-12-15 23:21:23 Re: [7.4.6] Calling PLpgSQL stored procedures with table row arguments via JDBC?