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 5E77E329D9F for ; Tue, 5 Oct 2004 21:42:11 +0100 (BST) 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 46050-10 for ; Tue, 5 Oct 2004 20:41:59 +0000 (GMT) Received: from web20822.mail.yahoo.com (web20822.mail.yahoo.com [216.136.227.135]) by svr1.postgresql.org (Postfix) with SMTP id 9A111329D83 for ; Tue, 5 Oct 2004 21:41:59 +0100 (BST) Message-ID: <20041005204158.92786.qmail@web20822.mail.yahoo.com> Received: from [24.248.12.141] by web20822.mail.yahoo.com via HTTP; Tue, 05 Oct 2004 13:41:58 PDT Date: Tue, 5 Oct 2004 13:41:58 -0700 (PDT) From: Jeff Eckermann Subject: Re: Stored Procedures returning a RECORD To: Kent Anderson , "Pgsql-Sql@Postgresql. Org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/33 X-Sequence-Number: 19136 --- Kent Anderson wrote: > I am attempting to use a stored procedure to pull a > report from the > database. My questions is if its even possible to > pull the data using a > function and then treat the returned data as a > normal recordset with the web > pages. > > The actual function looks like > > CREATE OR REPLACE FUNCTION submissionreport(integer, > date, text) RETURNS > RECORD AS' Your return value has to be of a specific type ("record" is too generic). Every table automatically has a type created, which each of its rows conforms to. Or you could create a custom type, using "create type". > > DECLARE > somekey ALIAS for $1; > somedate ALIAS for $2; > somesortorder ALIAS for $3; > submission RECORD; > BEGIN > > SELECT INTO submission (... stuff goes here) > ORDER BY sort; > > RETURN submission; > END; > ' LANGUAGE plpgsql; > > The error being returned is in the web pages" > SQLState: 08S01 Native Error Code: 1 Error while > executing the query; > ERROR: cannot display a value of type record" > > > > Kent Anderson > EZYield.com > 407-629-0900 > www.ezyield.com > > ======================================== > This electronic message transmission contains > information from the Company > that may be proprietary, confidential and/or > privileged. The information is > intended only for the use of the individual(s) or > entity named above. If > you are not the intended recipient, be aware that > any disclosure, copying or > distribution or use of the contents of this > information is prohibited. If > you have received this electronic transmission in > error, please notify the > sender immediately by replying to the address listed > in the "From:" field. > _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com