Re: [SQL] plpgsql array looping

2007-04-25 Thread Richard Albright
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) >

Re: [SQL] plpgsql array looping

2007-04-25 Thread John DeSoi
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 i

[SQL] plpgsql array looping

2007-04-24 Thread Richard Albright
I am attempting to create a moving average elements function that will return a set of elements in a particular moving average and am having difficulty iterating thrrough the passed in array properly. Any help would be greatly appreciated. code below... select getmovavgelements( aggarray(trade_d