Re: Passing refcursors between pl/pgsql functions

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Passing refcursors between pl/pgsql functions
Дата
Msg-id AANLkTinioTvwMZpBFVfk0iySWsxbwv=OchmwxS_d2J1z@mail.gmail.com
обсуждение исходный текст
Ответ на Passing refcursors between pl/pgsql functions  ("Reuven M. Lerner" <reuven@lerner.co.il>)
Ответы Re: Passing refcursors between pl/pgsql functions  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
>
> What I would like is something like the following, assuming it's possible:
>
> CREATE OR REPLACE FUNCTION fetch_from_refcursor(ref refcursor) RETURNS
> SETOF test_table AS $$
> BEGIN
>  RETURN FETCH 1 FROM ref; -- Does not work, but can it?
> END $$ language plpgsql;
>
> Is it possible to do such a thing?  I have a feeling that it isn't, but
> I'd love to be proven wrong.

Hello, there isn't any available statement for transformation from
cursor to table. You have to iterate over FETCH statement and to use a
RETURN NEXT statement.

Regards

Pavel Stehule

>
> Thanks in advance,
>
> Reuven
>
> --
> Reuven M. Lerner -- Web development, consulting, and training
> Mobile: +972-54-496-8405 * US phone: 847-230-9795
> Skype/AIM: reuvenlerner
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

В списке pgsql-general по дате отправления:

Предыдущее
От: "Reuven M. Lerner"
Дата:
Сообщение: Passing refcursors between pl/pgsql functions
Следующее
От: ghatpande@vsnl.net
Дата:
Сообщение: Re: NoSQL -vs- SQL