Received: from smtp017.mail.yahoo.com (smtp017.mail.yahoo.com [216.136.174.114]) by postgresql.org (8.11.3/8.11.4) with SMTP id f78CxY686849 for ; Wed, 8 Aug 2001 08:59:34 -0400 (EDT) (envelope-from chrup999@yahoo.com) Received: from proxy.compucom.com (HELO Z161842) (204.214.145.2) by smtp.mail.vip.sc5.yahoo.com with SMTP; 8 Aug 2001 12:59:30 -0000 X-Apparently-From: Message-ID: <001d01c12009$f6174840$5dd26383@corp.compucom.com> From: "Chris Ruprecht" To: "pgsql" Subject: Functions returning more than one value Date: Wed, 8 Aug 2001 07:59:29 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 1 X-MSMail-Priority: High X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200108/118 X-Sequence-Number: 4339 Hi all, How can I get more than one value back from a function? I have a situation here, where a function needs to return a value - but also needs to indicate from which type of record the value comes. The most elegant would be something like the 2 functions listed below. They don't work, since v_val3 and v_val4 are treated as constants in test2() and can not be changed. Is there a way this can make it into a future release? Best regards, Chris drop function test1(); create function test1() returns integer as ' declare v_res boolean; v_val1 integer; v_val2 integer; begin v_val1 := 1; v_val2 := 2; v_res := test2( v_val1, v_val2 ); return v_val1 + v_val2; end; ' language 'plpgsql'; drop function test2(integer, integer); create function test2(integer, integer) returns boolean as ' declare v_val3 alias for $1; v_val4 alias for $2; begin v_val3 := 3; v_val4 := 4; return true; end; ' language 'plpgsql'; _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com