Re: returning parameters from function

Поиск
Список
Период
Сортировка
Искать
От
Shoaib Mir
Тема
Re: returning parameters from function
Дата
Msg-id
bf54be870612120751w1185c4ebn57560507102d7834@mail.gmail.com
Ответ на
Список
Дерево обсуждения
returning parameters from function Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
Re: returning parameters from function Martijn van Oosterhout <kleptog@svana.org>
Re: returning parameters from function Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
Re: returning parameters from function Richard Huxton <dev@archonet.com>
Re: returning parameters from function Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
Re: returning parameters from function "Shoaib Mir" <shoaibmir@gmail.com>
Re: returning parameters from function Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
Re: returning parameters from function "Shoaib Mir" <shoaibmir@gmail.com>
You can use it as:

SELECT * FROM get_test_data(1000) AS t1 (emp_name VARCHAR);

--------------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 12/12/06, Rikard Pavelic <rikard.pavelic@zg.htnet.hr> wrote:
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 по дате отправления
От: Tom Lane
Дата:
От: Tom Lane
Дата:
FAQ