By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,708 Members | 2,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,708 IT Pros & Developers. It's quick & easy.

PLPGSQL Returning Records

P: n/a
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;

.....

It seems that the function does not return anything after the loop. Can
anyone help me on that ?

Thanks
Alex

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.