| From: | Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Usage of function retruning record in query |
| Date: | 2011-07-04 13:41:12 |
| Message-ID: | 868vseduyv.fsf@mgm.protecting.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
In article <1309762075448-4549140(dot)post(at)n5(dot)nabble(dot)com>,
gmb <gmbouwer(at)gmail(dot)com> writes:
> 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.
SELECT itemid, (calcvalues(itemid)).* FROM itemlist
| From | Date | Subject | |
|---|---|---|---|
| Next Message | gmb | 2011-07-04 13:59:49 | Re: Usage of function retruning record in query |
| Previous Message | gmb | 2011-07-04 06:47:55 | Usage of function retruning record in query |