From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Calin Meze <mezecalin(at)yahoo(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Help me do a LOOP |
Date: | 2005-12-21 09:34:32 |
Message-ID: | 43A921A8.3010702@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-12-21 09:38:27 | Re: Commiting after certain no of rows have been deleted |
Previous Message | Jim C. Nasby | 2005-12-21 00:33:39 | Re: Does VACUUM reorder tables on clustered indices |