X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8450F9DCD39 for ; Fri, 16 Dec 2005 05:09:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65714-03 for ; Fri, 16 Dec 2005 05:09:43 -0400 (AST) X-Greylist: delayed 00:10:26.411586 by SQLgrey- Received: from smtp2.anpe.fr (unknown [80.124.143.16]) by postgresql.org (Postfix) with ESMTP id 4A5C69DCD25 for ; Fri, 16 Dec 2005 05:09:39 -0400 (AST) Received: from homere01.anpe.fr (amadeus [127.0.0.1]) by smtp2.anpe.fr (antivirus) with ESMTP id 030CA73EF5 for ; Fri, 16 Dec 2005 09:59:12 +0100 (CET) Received: from HOMERE03.anpe.fr ([10.0.6.140]) by homere01.anpe.fr with Microsoft SMTPSVC(6.0.3790.1830); Fri, 16 Dec 2005 09:58:56 +0100 Received: from [10.0.32.170] ([10.0.32.170]) by HOMERE03.anpe.fr with Microsoft SMTPSVC(6.0.3790.1830); Fri, 16 Dec 2005 09:58:56 +0100 Message-ID: <43A281E0.3070403@anpe.fr> Date: Fri, 16 Dec 2005 09:59:12 +0100 From: Patrick JACQUOT User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: RETURN SET OF DATA WITH CURSOR References: <43A18B25.1010705@carvalhaes.net> <43A193B4.5070206@archonet.com> <43A1A09D.6020708@carvalhaes.net> In-Reply-To: <43A1A09D.6020708@carvalhaes.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Dec 2005 08:58:56.0376 (UTC) FILETIME=[F248A780:01C6021E] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/137 X-Sequence-Number: 23679 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 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)