Returning recordsets from functions

From: Torbj=?ISO-8859-1?B?9g==?=rn Andersson <tobbe(at)embryo(dot)se>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Returning recordsets from functions
Date: 2001-10-26 05:45:27
Message-ID: B7FE2FD1.1186%tobbe@embryo.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I need to migrate several MSSQL stored procedures to Postgres. Most of them
return several rows from complex select statements. I have created several
functions that return single values but haven't been able to create one that
returns several rows.

I have also visited The Postgres Cookbook but didn't understand enough.

Could some one please complete the code below so that it will work:

CREATE FUNCTION return_rows (int4)
RETURNS ????? AS '

SELECT name, grade FROM exam WHERE id > $1;

' LANGUAGE 'sql';

Is it possible as an SQL-function or should it be a PLPGSQL-function?

Regards

Torbjörn Andersson
---------------------------------------------------
Embryo Communication phone: +46 (0) 31-774 39 11(00)
Kungsgatan 7a fax: +46 (0)31 774 07 80
S-411 19 Göteborg mobile: 0708-30 70 04
Sweden home: http://www.embryo.se/
mail: torbjorn(dot)andersson(at)embryo(dot)se
---------------------------------------------------

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Tan 2001-10-26 07:35:31 copy command
Previous Message Phillip J. Allen 2001-10-25 19:22:44 Cannot Modify or Delete 'Some' Old Records?