Re: Selecting from a function(x,y) returning a row-type(sum, prod) - Mailing list pgsql-general

From A. Kretschmer
Subject Re: Selecting from a function(x,y) returning a row-type(sum, prod)
Date
Msg-id 20070430141419.GD9076@a-kretschmer.de
Whole thread Raw
In response to Selecting from a function(x,y) returning a row-type(sum, prod)  (Heiko Klein <Heiko.Klein@gmx.net>)
Responses Re: Selecting from a function(x,y) returning a row-type(sum, prod)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
am  Mon, dem 30.04.2007, um 15:45:18 +0200 mailte Heiko Klein folgendes:
> Hi,
>
> I'm trying to select data from a table, converting two values and return
> all four. Maybe this is best explained with an example:
>
> The function from the documentation on pl/pgsql:
>
> CREATE FUNCTION sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$
> BEGIN
>     sum := x + y;
>     prod := x * y;
> END;
> $$ LANGUAGE plpgsql;
>
> And a table 'myvals' with x and y integer values:
> CREATE TABLE myvals (INT x, INT y);
>
>
> How can I do the following:
>
> select * from myvals, sum_n_product(myvals.x, myvals.y);

select x, y, sum_n_product(x,y) from myvals;


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: "John D. Burger"
Date:
Subject: Re: Temporal Units
Next
From: "psql psql"
Date:
Subject: Re: Stemming not working with tsearch2() function