From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Passing refcursors between pl/pgsql functions |
Date: | 2010-10-13 09:35:27 |
Message-ID: | AANLkTinioTvwMZpBFVfk0iySWsxbwv=OchmwxS_d2J1z@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | ghatpande | 2010-10-13 10:12:26 | Re: NoSQL -vs- SQL |
Previous Message | Joe La Frite | 2010-10-13 09:24:21 | Seg fault on PQconnectdb |