function that return multiple fields and rows

From: Wooi K <wooi2(at)halfmind(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: function that return multiple fields and rows
Date: 2000-12-11 11:46:24
Message-ID: 00121105462400.22067@kobeta.halfmind.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alessio Bragadini 2000-12-11 12:20:11 Re: Problems with starting Postgres
Previous Message Zeljko Trogrlic 2000-12-11 11:23:23 Re: Re: Re: Why PostgreSQL is not that popular as MySQL ?