Using SETOF in plpgsql function

From: hlefebvre <hlefebvre(at)lexbase(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Using SETOF in plpgsql function
Date: 2000-08-23 10:07:36
Message-ID: 39A3A268.79F1BC27@lexbase.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I'd like to return a set of integer in an pl/pgsql function. How can I
do that ?

I've tried things like that, put I've an error when executing :

CREATE FUNCTION SP_UPLES() RETURNS setof INTEGER AS '
DECLARE ID INTEGER;
BEGIN
select a into id from foo;
return ID ;
END;

CREATE FUNCTION SP_UPLES() RETURNS setof INTEGER AS '
DECLARE ID setof INTEGER;
BEGIN
select a into id from foo;
return ID ;
END;

CREATE FUNCTION SP_UPLES() RETURNS setof INTEGER AS '
BEGIN
select a into id from foo;
return select a from foo;
END;

Any help is welcomed.
Thanks.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Tille 2000-08-23 10:10:38 Date of creation and of change
Previous Message Joerg Hessdoerfer 2000-08-23 08:10:36 Re: Continuous inserts...