Re: PLPGSQL Returning Records

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Alex <alex(at)meerkatsoft(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PLPGSQL Returning Records
Date: 2003-11-18 16:38:19
Message-ID: 20031118083723.D41108@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 18 Nov 2003, Alex wrote:

> Hi,
> I am trying to return a recod from from my function but for some reason
> it does not work.
>
> Here is may problem. I use a for loop to generate the first batch of
> records. Once the loop is completed I want to add another record. But at
> that point fails.
>
> ....
>
> FOR rec IN SELECT ....
> LOOP
>
> RETURN NEXT r;
> END LOOP;
>
> do some assignments
> RETURN r;

I think you want RETURN NEXT r; (or rec) to add the record to the
set of output rows.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-11-18 16:49:33 E-Week Magazine looking for users
Previous Message scott.marlowe 2003-11-18 15:50:20 Re: Newbie: port