Re: plpgsql array looping

From: Richard Albright <ralbright(at)insiderscore(dot)com>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql array looping
Date: 2007-04-25 13:54:29
Message-ID: 1177509269.9556.2.camel@MSI1036
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

yeah i noticed that this morning, it used to be a while loop, for some
reason (probably parser related) it keeps giving me an error on the exit
when statement in the loop.

On Wed, 2007-04-25 at 09:38 -0400, John DeSoi wrote:
> One problem (unless you intend to only look at every other element)
> is that you are incrementing idxptr explicitly in your loop. The FOR
> loop does that for you. This is the reason your output shows only
> even values.
>
> John
>
>
> On Apr 24, 2007, at 4:42 PM, Richard Albright wrote:
>
> > for idxptr in 1 .. array_upper(p_idxarray, 1)
> > loop
> > exit when p_idxarray[idxptr] >= p_idx;
> > idxptr := idxptr +1;
> > raise notice 'idx ptr: %', idxptr;
> > end loop;
>
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
--
Rick Albright
Senior Quantitative Analyst
Indie Research, LLC
254 Witherspoon Street
Princeton, NJ 08542
(609)497-1030
ralbright(at)insiderscore(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2007-04-25 14:16:56 Re: Which function transform x,y to latitude/longitude?
Previous Message John DeSoi 2007-04-25 13:38:09 Re: plpgsql array looping