Re: Callable Statements - Mailing list pgsql-jdbc

From floess@mindspring.com
Subject Re: Callable Statements
Date
Msg-id 1597904.1049892748605.JavaMail.nobody@wamui05.slb.atl.earthlink.net
Whole thread Raw
In response to Callable Statements  (Mark French <frenchmb@tpg.com.au>)
Responses Re: Callable Statements
List pgsql-jdbc
Nic:

Here is a cheesy example question:

Assume I had a function, foo_function, that returns SETOF foo_table.  Internally, the function does nothing more than a
"select* from foo" (also assume it does the return next, etc - again this is a cheesy question), are you saying it will
bepossible to use a CallableStatement and get a ResultSet? 

If so, can I assume that the CallableStatement will outperform using a PreparedStatement and calling the function as
I'vementioned in my original post? 

My apologies for my response:  1) I am doing some contract work in another city and haven't kept up closely on latest
development,2) as of 7.3.2 this was the case. 

Thanks,

Scot

-------Original Message-------
From: Nic Ferrier <nferrier@tapsellferrier.co.uk>
Sent: 04/09/03 08:45 AM
To: floess@mindspring.com
Subject: Re: [JDBC] Callable Statements

>
> floess@mindspring.com writes:

> Mark:
>
> To answer your question, you can't use CallableStatement where you
> return a row, rows or RECORD type.
>
> For a function returning multiple rows, a single row, or RECORD you
> would have to use a PreparedStatement.  The string passed to your
> prepared statement would resemble "select * from function"
>
> I don't have an example on hand...but I may be able to get one for
> you later.

To clarify, PostgreSQL JDBC has always been able to call functions
that return ref cursor types as ResultSet's. If you look through the
archives of this list you'll find plenty of examples (searching for
my name will provide at least one example).

CallableStatement support for such procs has recently been added to
the CVS version of PostgreSQL JDBC.


Nic

>


pgsql-jdbc by date:

Previous
From: Nic Ferrier
Date:
Subject: Re: Callable Statements
Next
From: floess@mindspring.com
Date:
Subject: Re: Callable Statements