Re: plpgsql array looping - Mailing list pgsql-sql

From John DeSoi
Subject Re: plpgsql array looping
Date
Msg-id 965E504A-7301-4531-B381-A1EEEB539344@pgedit.com
Whole thread Raw
In response to plpgsql array looping  (Richard Albright <ralbright@insiderscore.com>)
Responses Re: plpgsql array looping  (Richard Albright <ralbright@insiderscore.com>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Joe
Date:
Subject: Re: We all are looped on Internet: request + transport = invariant
Next
From: Richard Albright
Date:
Subject: Re: plpgsql array looping