X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 243078B9BA0 for ; Tue, 22 Feb 2005 23:29:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54146-01 for ; Tue, 22 Feb 2005 23:29:31 +0000 (GMT) Received: from fed1rmmtao05.cox.net (fed1rmmtao05.cox.net [68.230.241.34]) by svr1.postgresql.org (Postfix) with ESMTP id B51488B9B5D for ; Tue, 22 Feb 2005 23:29:32 +0000 (GMT) Received: from dnd2 ([68.2.114.10]) by fed1rmmtao05.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050222232933.RRVM3901.fed1rmmtao05.cox.net@dnd2> for ; Tue, 22 Feb 2005 18:29:33 -0500 From: "Steve - DND" To: Subject: Pagination with Output Variables? Date: Tue, 22 Feb 2005 16:29:30 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/258 X-Sequence-Number: 20369 I have a MSSQL Stored Procedure that returns a particular section of a resultset depending on the desired "page". This procedure also has a parameter marked as OUTPUT which indicates the total number of records in the actual resultset. Is there a way to do something similar in PG or does TotalRecords need to be part of the type returned by the function. MSSQL Procedure CREATE PROCEDURE PageCustomers ( @Page int, @PerPage int, @TotalRecords int OUTPUT ) AS --Do stuff to determine number of records SELECT @TotalRecords = COUNT(*) FROM tmpCustomers --Get the actual data SELECT CustomerID, CustomerName, EmailAddress FROM tmpCustomers WHERE ... Would the only way to do this in PG to have my function return a type like this? CREATE TYPE "PageCustomers_type" AS ("TotalRecords" int4, "CustomerID" int4, "CustomerName" varchar(100), "EmailAddress" varchar(100)); Can a function return two type results? So that the first type would be just the total number of records, and the second type would be the resultset of customers? Thanks, Steve