Thread: functions problems

functions problems

From
"Mario Alberto Soto Cordones"
Date:
Hi.

i have a functions what return one column and work good but when create a
new function to return 2 column´s it´s say error...

any idea

thank
Mario



Re: functions problems

From
Randall Lucas
Date:
Mario,

Either have it return a "record" type and use an explicit column
definition list, or else declare a table with the columns as you like
and return a type of a row from that table.

The first one is easy:

create or replace function test__show_record_return(int) returns record
as ' select $1 +1, $1 +2;
' language sql;

select * from test__show_record_return(5) as (plusone int, plustwo int);

Best,

Randall


On Monday, April 21, 2003, at 04:48 PM, Mario Alberto Soto Cordones
wrote:

> Hi.
>
> i have a functions what return one column and work good but when
> create a
> new function to return 2 column´s it´s say error...
>
> any idea
>
> thank
> Mario
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>