Skip site navigation (1) Skip section navigation (2)

Returning multiple rows in functions

From: Kief Morris <k(dot)morris(at)bitbull(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Returning multiple rows in functions
Date: 2000-03-06 15:54:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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?



pgsql-sql by date

Next:From: Ross J. ReedstromDate: 2000-03-06 16:24:33
Subject: Re: [SQL] index file's growing big
Previous:From: Justin LongDate: 2000-03-06 15:31:39
Subject: Selecting random element?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group