| From: | adam lawrence <name_adam(at)yahoo(dot)com(dot)au> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Looping through Arrays |
| Date: | 2006-10-10 07:55:16 |
| Message-ID: | 20061010075516.54746.qmail@web27209.mail.ukl.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi
I want to be able to loop through an array. The code I have used in the past is:
FOR i IN array_lower(arrayvar,1) .. array_upper(arrayvar,1) LOOP
currentvalue:=arrayvar[1][i];
RAISE NOTICE '%', currentvalue;
END LOOP;
But now I need to loop through the whole array, not just the one element. I want to do something like:
FOR j in ....LOOP
FOR i IN array_lower(arrayvar,1) .. array_upper(arrayvar,1) LOOP
currentvalue:=arrayvar[j][i];
RAISE NOTICE '%', currentvalue;
END LOOP;
END LOOP;
How to I set the upper and lower bounds for j?
---------------------------------
Yahoo! Messenger - with free PC-PC calling and photo sharing.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martins Mihailovs | 2006-10-10 08:49:06 | Re: UTF-8 |
| Previous Message | Alban Hertroys | 2006-10-10 07:52:28 | Re: plpgsql handling a set of values |