Thread: Returning multiple rows in functions
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
Kief Morris writes: > 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? No. Perhaps making a view would fit your application. -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden