Received: from ns2.packetvideo.com ([63.214.191.68]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f02LJMO75317 for ; Tue, 2 Jan 2001 16:19:22 -0500 (EST) (envelope-from schwarz@PacketVideo.COM) Received: from misty.packetvideo.com ([63.214.191.76]) by ns2.packetvideo.com (8.9.3/8.9.3) with ESMTP id NAA48655 for ; Tue, 2 Jan 2001 13:18:47 -0800 (PST) (envelope-from schwarz@PacketVideo.com) Received: by misty.packetvideo.com with Internet Mail Service (5.5.2653.19) id ; Tue, 2 Jan 2001 13:15:13 -0800 Message-ID: <72660A24B978D411BB8A00B0D03DFE0115117D@misty.packetvideo.com> From: Brett Schwarz To: "'pgsql-sql@postgresql.org'" Subject: FUNCTION returing multiple rows Date: Tue, 2 Jan 2001 13:15:12 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200101/18 X-Sequence-Number: 679 I have seen in the postings that it is not possible to return multiple rows from a function. However, when I look at the programmers guide (Ch. 4), it almost leads me to believe otherwise: ---------------------8<--------------------------------------------------- The following more interesting example takes a single argument of type EMP, and retrieves multiple results: select function hobbies (EMP) returns set of HOBBIES as 'select (HOBBIES.all) from HOBBIES where $1.name = HOBBIES.person' language 'sql'; ---------------------8<--------------------------------------------------- I know that it only says 'multiple results' but with the 'HOBBIES.all', it almost leads me to believe that it is retrieving all of the fields. Is 'all' a keyword, or is this just one field in HOBBIES? Also, is there any type of function return multiple rows (plpgsql, pltcl, etc)? If not, then is there anyway to fake it out to do this. Could I concatenate the fields together to form one field per row. This would look like multiple results of 1 field to PG. Also, if I did this, is there a delimiter I should use? for example: select field1 || ':' || field2 || ':' || field3 from some_table; Where ":" is the delimiter to send back. Sorry for this question, but I am porting over an app from Oracle, and they do not want to change the java code that calls this; so I need to make this work somehow. thanks, --brett