Re: function that return multiple fields and rows

From: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
To: Wooi K <wooi2(at)halfmind(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: function that return multiple fields and rows
Date: 2000-12-11 16:49:22
Message-ID: 0012111149221R.00289@comptechnews
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 11 December 2000 06:46, Wooi K wrote:
> Hi All,
> I would like to write a function that returns multiple rows and multiple
> fields, something like this. I know the syntax is probably wrong, any
> helps would be appreciated.
>
> CREATE FUNCTION GetGuestbookMessages (int4) RETURNS SETOF VARCHAR AS
> '
> SELECT guestname, guestemail FROM GuestbookMessages WHERE UserId =
> $1 ' LANGUAGE 'sql';
>
> notice that I want to return more than one field and more than one record
> in the above function. Thanks.
>
> wooi.

Why do you need this SELECT to be wrapped inside of a function? Why not just
use your SELECT directly? From where would you call this function (if it
could be made, which I don't think it can)?

--
-------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
- CompTechNews Message Board http://www.comptechnews.com/ -
- CompTechServ Tech Services http://www.comptechserv.com/ -
---------- http://www.comptechnews.com/~reaster/ ------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-12-11 16:50:56 RE: Re: Re: Why PostgreSQL is not that popular as MySQL ?
Previous Message George Johnson 2000-12-11 16:45:01 Re: one other big mysql->postgresql item