Re: Callable Statements

Поиск
Список
Период
Сортировка
Искать
От
Nic Ferrier
Тема
Re: Callable Statements
Дата
Msg-id
8765pnltar.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Ответ на
Re: Callable Statements (floess@mindspring.com)
Список
Дерево обсуждения
Callable Statements Mark French <frenchmb@tpg.com.au>
Re: Callable Statements Nic Ferrier <nferrier@tapsellferrier.co.uk>
floess@mindspring.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
В списке pgsql-jdbc по дате отправления
От: floess@mindspring.com
Дата:
Сообщение: Re: Callable Statements
От: Chris White
Дата:
FAQ