Re: Loop through records

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Emiliano Amilcarelli <amiemi(at)tin(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Loop through records
Date: 2005-11-12 15:30:06
Message-ID: 27663.1131809406@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Emiliano Amilcarelli <amiemi(at)tin(dot)it> writes:
> I managed to get results printed out from the function,

What was the problem exactly? I couldn't see a reason for that error
message --- the only thing I could find wrong in your function was
spelling ">=" with a space in the middle. After fixing that and making
a simple ERRORS table, it worked fine.

> but now i cannot If..THEN working inside the same function.

It looks like you're expecting FOUND to be set inside the loop, which it
is not. Seems rather pointless --- if you're inside the loop body at
all, then it found a record, no? A FOR-loop sets FOUND *when it exits*,
to tell code after the loop whether any iterations were performed or
not.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Reed Kempf 2005-11-12 16:48:07 postgresql database password
Previous Message Emiliano Amilcarelli 2005-11-12 12:00:58 Re: Loop through records