From: tlund79 <thomas.lund@eniro.no>
To: pgsql-sql@postgresql.org
Subject: Re: Returning data from multiple functions
Date: Thu, 10 Nov 2011 03:37:12 -0800 (PST)
Message-ID: <1320925032428-4980786.post@n5.nabble.com> (raw)
In-Reply-To: <1320923650898-4980747.post@n5.nabble.com>
References: <1320923650898-4980747.post@n5.nabble.com>
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.htm...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: thomas.lund@eniro.no
Subject: Re: Returning data from multiple functions
In-Reply-To: <1320925032428-4980786.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox