Hi, Merlin. Thanks for the clarification and explanation; it was
quite helpful. I'll give it a shot!
Reuven
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Thu, Oct 14, 2010 at 12:31 AM, Reuven M. Lerner wrote:
>
>
> Hi, Merlin. You wrote:
>
>> In other words, something like this:
>>
>> create or replace function test() returns setof foo as
>> $$
>> declare
>> r refcursor;
>> f foo;
>> i int;
>> begin
>> open r for select * from foo;
>>
>
Hi, Merlin. You wrote:
In other words, something like this:
create or replace function test() returns setof foo as
$$
declare
r refcursor;
f foo;
i int;
begin
open r for select * from foo;
for i in 1..10
loop
fetch 1 from r into f;
exit when not found;
retur
On Wed, Oct 13, 2010 at 5:35 AM, Pavel Stehule wrote:
>>
>> 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
>
> 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 su