Re: Callable Statements

From: Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>
To: 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 13:00:28
Message-ID: 8765pnltar.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

floess(at)mindspring(dot)com writes:

> 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?

I don't know. I haven't done anything about SETOF.

What you CAN do is return a ref cursor. Here's an example proc:

-- create or replace function list ( ) returns refcursor as '
declare
entrys refcursor;
begin
open entrys for
select id, title, date, entry from someentrys;
return entrys;
end;
-- ' language 'plpgsql';

> 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?

The performance characteristics of statements have been altered as
well. It's possible to turn off the downloading of the entire query.

In general procs will be quicker than PS's but only because they
generally live for longer.

Nic

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chris White 2003-04-09 16:25:35 Re: Problems with Large Objects using Postgres 7.2.1
Previous Message floess 2003-04-09 12:55:46 Re: Callable Statements