Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 21392BA6CB8 for ; Thu, 10 Nov 2011 07:37:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 75924-05 for ; Thu, 10 Nov 2011 11:37:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mail.postgresql.org (Postfix) with ESMTP id 05413BA6CB7 for ; Thu, 10 Nov 2011 07:37:12 -0400 (AST) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1ROSwS-00006B-E3 for pgsql-sql@postgresql.org; Thu, 10 Nov 2011 03:37:12 -0800 Date: Thu, 10 Nov 2011 03:37:12 -0800 (PST) From: tlund79 To: pgsql-sql@postgresql.org Message-ID: <1320925032428-4980786.post@n5.nabble.com> In-Reply-To: <1320923650898-4980747.post@n5.nabble.com> References: <1320923650898-4980747.post@n5.nabble.com> Subject: Re: Returning data from multiple functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.778 tagged_above=-5 required=5 tests=BAYES_00=-1.9, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201111/49 X-Sequence-Number: 36022 I know got this far thanks to Pavle Stehule. The function worked and returned the data when the variables was predefined after "return query". When tried to replace these with variables passed through the function call I got this message; ERROR: syntax error at or near "RETURN" LINE 1: ...ll select ppr_pf_inn_antall( $1 , $2 , $3 , $4 , $5 ) RETURN ^ QUERY: select ppr_pf_inn_verdi( $1 , $2 , $3 , $4 , $5 ) union all select ppr_pf_inn_antall( $1 , $2 , $3 , $4 , $5 ) RETURN CONTEXT: SQL statement in PL/PgSQL function "ppr_test_to_funk" near line 7 CREATE OR REPLACE FUNCTION ppr_test_to_funk(aarstall int, frauke int, tiluke int, prosjektkode int[], teamkode int[]) RETURNS setof integer AS $BODY$ I called the function with this: select * from ppr_test_to_funk(2011,1,52,array[3], array[7,4]) Am I lost or are this possible? *Updated function:* BEGIN return query select ppr_pf_inn_verdi($1,$2,$3,$4,$5) union all select ppr_pf_inn_antall($1,$2,$3,$4,$5) RETURN; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION ppr_test_to_funk() OWNER TO oystein; -- View this message in context: http://postgresql.1045698.n5.nabble.com/Returning-data-from-multiple-functions-tp4980747p4980786.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com.