Re: returning parameters from function - Mailing list pgsql-general

From Rikard Pavelic
Subject Re: returning parameters from function
Date
Msg-id 457EB765.4010908@zg.htnet.hr
Whole thread Raw
In response to Re: returning parameters from function  ("Shoaib Mir" <shoaibmir@gmail.com>)
Responses Re: returning parameters from function  ("Shoaib Mir" <shoaibmir@gmail.com>)
List pgsql-general
Shoaib Mir wrote:
> You can use a SETOF function as:
>
> CREATE OR REPLACE FUNCTION get_test_data (numeric)
>     RETURNS SETOF RECORD AS
> $$
> DECLARE
>     temp_rec    RECORD;
> BEGIN
>     FOR temp_rec IN (SELECT ename FROM emp WHERE sal > $1)
>     LOOP
>         RETURN NEXT temp_rec;
>     END LOOP;
>     RETURN;
> END;
> $$ LANGUAGE plpgsql;
>
This doesn't work. ;(
I get ERROR: a column definition list is required for functions
returning "record"
SQL state: 42601
when running this function

Regards,
Rikard

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: where can i find posges sql include directory...FC5.installing
Next
From: Matthias.Pitzl@izb.de
Date:
Subject: Re: returning parameters from function