Calin Meze wrote:
> I need to test each record of a cursor for some requirements,
> something like this
[snip]
> -- the problem is that I do not know how to make the while loop
> execute until the last record "WHILE (still in the cursor)"... So I
> need something like
>
>
> Can anyone help me with this? It really seems silly... but I cannot
> get to solve this, I do not know where to look for syntax like this
> or tutorials like this.
Assuming this is plpgsql you are probably looking for the FOUND
pseudo-variable. See Ch 36.6.6 Obtaining the Result Status
You don't actually need to bother with a cursor in plpgsql, just loop
over a SELECT (Ch 36.7.4 Looping Through Query Results). That basically
*is* a cursor internally.
-- Richard Huxton Archonet Ltd