From: gmb <gmbouwer@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Usage of function retruning record in query
Date: Sun, 3 Jul 2011 23:47:55 -0700 (PDT)
Message-ID: <1309762075448-4549140.post@n5.nabble.com> (raw)
Hi
I have a stored function returning a record consisting of two field, and
receiving as input a single identifier:
CREATE FUNCTION calcvalues(IN itemid VACHAR, OUT calcval1 NUMERIC, OUT
calcval2 NUMERIC)
RETURNS record...
Now, I want to use this function in a query as follows:
SELECT itemid, calcvalues(itemid) FROM itemlist;
which returns:
itemid | calcvalues
--------+-------------
4 | (0.67,10.00)
5 | (1.55,45.00)
6 | (3.60,69.00)
Now, how should I go about to give the following output:
itemid | calcval1 | calcval2
--------+----------+----------
4 | 0.67 | 10.00
5 | 1.55 | 45.00
6 | 3.60 | 69.00
Any feedback will be appreciated.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Usage-of-function-retruning-record-in-query-tp4549140p454914...
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: gmbouwer@gmail.com
Subject: Re: Usage of function retruning record in query
In-Reply-To: <1309762075448-4549140.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