Re: Looping through Arrays

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "adam lawrence" <name_adam(at)yahoo(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Looping through Arrays
Date: 2006-10-12 01:47:46
Message-ID: b42b73150610111847y140e0fd4wad2bbe38ce1592c7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/10/06, adam lawrence <name_adam(at)yahoo(dot)com(dot)au> wrote:
> 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?

FOR j IN array_lower(arrayvar, 2)..array_upper(arrayvar, 2) LOOP

:-)

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2006-10-12 02:01:47 Re: more anti-postgresql FUD
Previous Message Merlin Moncure 2006-10-12 01:38:11 Re: more anti-postgresql FUD