Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 27C579FB22F for ; Tue, 26 Jun 2007 13:15:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 89404-07 for ; Tue, 26 Jun 2007 13:14:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pyxis.powervt.com.ar (host3.powervt.com.ar [200.43.63.66]) by postgresql.org (Postfix) with ESMTP id 812209FB1EC for ; Tue, 26 Jun 2007 13:15:06 -0300 (ADT) Received: from pcfhevia ([201.216.249.98]) by pyxis.powervt.com.ar (IPGroup Mail Server) with ESMTP id 1OT48953; Tue, 26 Jun 2007 13:15:04 -0300 From: "Fernando Hevia" To: "'Bart Degryse'" , Subject: Re: NO DATA FOUND Exception Date: Tue, 26 Jun 2007 13:15:16 -0300 Organization: IP-TEL Message-ID: <053b01c7b80d$2ebb9740$8f01010a@iptel.com.ar> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <468140AB.A3DD.0030.0@indicator.be> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: Ace3/4/FSZcqlxbwQVmRGXx6xqibcAADHSLQ X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/221 X-Sequence-Number: 28711 >>"Fernando Hevia" 2007-06-26 16:25 >>> >>How do I refer a specific field of the returned row from outside the >>function? How should I write the query in order to show only fields 1 = and 3, for example? >In case you would like to use set returning functions... >=A0 >if your function will return records with the same structure as an = existing >table >CREATE FUNCTION my_func() RETURNS SETOF=A0my_table AS ... >=A0 >if not you have to define the returning type >CREATE TYPE func_row AS ("field1" varchar(10), "field2" integer, = "field3" >integer, ...) >CREATE FUNCTION my_func() RETURNS SETOF=A0func_row AS ... > >now you can use your function >SELECT * FROM my_func(); >=A0 >or >=A0 >SELECT A.field1, A.field2 >FROM my_func() A left join my_func() B on A.field2 =3D B.field3 >WHERE A.field1 like 'B%'; Exactly what I was looking for.=20 Thanks!!