Returning multiple rows in functions

Поиск
Список
Период
Сортировка
От Kief Morris
Тема Returning multiple rows in functions
Дата
Msg-id 30C64922AF42D311A96D00A0C91D0B107EB54D@mailpost.syzygy.net
обсуждение исходный текст
Ответы Re: [SQL] Returning multiple rows in functions
Список pgsql-sql
I'm missing something in the docs - how can I write a function
that returns multiple rows? I want to do the equivalent of:
   select name from user_category where id = 21;

I create the following function:
   create function getid (int4) returns text as 'select name from mytable
where id = $1;' language 'sql';

... but it only returns the first matching row. Is there
a way to return all the matching rows?

Thanks,
Kief



В списке pgsql-sql по дате отправления:

Предыдущее
От: Justin Long
Дата:
Сообщение: Selecting random element?
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [SQL] Returning multiple rows in functions