X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 567654758DC for ; Sun, 2 Feb 2003 10:44:06 -0500 (EST) Received: from fep03-mail.bloor.is.net.cable.rogers.com (fep03-mail.bloor.is.net.cable.rogers.com [66.185.86.73]) by postgresql.org (Postfix) with ESMTP id 810A4475843 for ; Sun, 2 Feb 2003 10:44:05 -0500 (EST) Received: from spook ([65.48.10.226]) by fep03-mail.bloor.is.net.cable.rogers.com (InterMail vM.5.01.05.06 201-253-122-126-106-20020509) with ESMTP id <20030202154406.KLEG121195.fep03-mail.bloor.is.net.cable.rogers.com@spook> for ; Sun, 2 Feb 2003 10:44:06 -0500 Message-ID: <000d01c2cad1$eb3a7e50$6401a8c0@spook> From: "John Cavacas" To: Subject: How to return records from a function Date: Sun, 2 Feb 2003 10:44:05 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Authentication-Info: Submitted using SMTP AUTH LOGIN at fep03-mail.bloor.is.net.cable.rogers.com from [65.48.10.226] using ID at Sun, 2 Feb 2003 10:44:06 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/33 X-Sequence-Number: 11431 Hello everyone. I've spent the last few hours trying to come up with a function that at the most basic returns the result of a SELECT * FROM . This is easy to do in something like MSSQL or Oracle. For example in MSSQL i can do something like: CREATE PROCEDURE proc_name AS BEGIN SELECT * FROM sometable END How do I do something like that with a Postgresql function/stored procedure? All I really want to know is how to by using a function how can I return the results of a SELECT * query!? The end result of the query I need is more complicated, but I can't even get something that easy to work. Are functions unable to return result sets?? All of the examples i've seen always return a single value, like an int. That doesn't do me any good. I want to use a few stored procedures to create some faster processing for some queries that involve 3-4 tables plus require some input parameters, and return a result set. Any help would be appreciated. I've just recently started using PostgreSQL and I'm very impressed! I'm sure I'm jsut overlooking something easy, but for the life of me i just can't figure it out. Thanks, John