Re: returning parameters from function

From: Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr>
To: Shoaib Mir <shoaibmir(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: returning parameters from function
Date: 2006-12-12 14:06:29
Message-ID: 457EB765.4010908@zg.htnet.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias.Pitzl 2006-12-12 14:08:35 Re: returning parameters from function
Previous Message Rikard Pavelic 2006-12-12 14:05:06 Re: returning parameters from function