Re: Callable Statements

From: floess(at)mindspring(dot)com
To: Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>, floess(at)mindspring(dot)com
Cc: Mark French <frenchmb(at)tpg(dot)com(dot)au>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Callable Statements
Date: 2003-04-09 12:51:37
Message-ID: 1597904.1049892748605.JavaMail.nobody@wamui05.slb.atl.earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 be possible 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've mentioned 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(at)tapsellferrier(dot)co(dot)uk>
Sent: 04/09/03 08:45 AM
To: floess(at)mindspring(dot)com
Subject: Re: [JDBC] Callable Statements

>
> floess(at)mindspring(dot)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

>

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message floess 2003-04-09 12:55:46 Re: Callable Statements
Previous Message Nic Ferrier 2003-04-09 12:45:06 Re: Callable Statements