Re: RETURN SET OF DATA WITH CURSOR

From: Patrick JACQUOT <patrick(dot)jacquot(at)anpe(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: RETURN SET OF DATA WITH CURSOR
Date: 2005-12-16 08:59:12
Message-ID: 43A281E0.3070403@anpe.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

grupos wrote:

> Hi Richard,
>
> Thanks for your promptly answer. I don't have experience returning
> refcursor but my choice would be it.
> I read the documentation but I didn't find any example with my
> necessity...
>
> Could you give me a small example on the same "basis" that I want?
>
> Thanks,
>
> Rodrigo Carvalhaes
>
> Richard Huxton wrote:
>
>> grupos wrote:
>>
>>> Hi !
>>>
>>> I am making one plpgsql function and I need to return of setof data
>>> using a cursor.
>>>
>>> The problem is that my function is returning only the first row and
>>> column of the query. This query have more than 80 columns and 1.000
>>> rows. Enyone have any tip to give me?
>>
>>
>> Yes - decide whether you are returning a set of rows or a refcursor.
>>
>> Check the plpgsql docs again for how to return SETOF <rowtype> using
>> the RETURN NEXT statement. Then you call your function like: SELECT *
>> FROM my_func();
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
There is a standard way :

Select * from memberstatus A where not exists
(select * from emberstatus B where B.member_id=A.member_id and
B.status_date >A.status_date)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-12-16 09:24:22 Re: Need SQL Help Finding Current Status of members
Previous Message Michael Fuhr 2005-12-16 02:58:52 Re: Need SQL Help Finding Current Status of members