Subject RE: [firebird-support] Strange behavior in stored procedure
Author Alan McDonald
> Could be me, but that sounds like a bug or you're wrong.
> SELECT [FIRST] returns a resultset, which is handled by the FOR loop.
> Why this should "return the same result ad infinitum" is unclear to me. If
> this would be the case, how would this behave differently from a normal
> SELECT that returns a resultset? There IS an endpoint for a FIRST 1,
> namely after a single iteration of the FOR loop.
> It's not like the SELECT is executed for each FOR or anything.
> Sorry, I still fail to see why this would be wrong (despite the lack of an
> ORDER BY clause in the OPs post ;) ...
> Martijn Tonies

the select first statement is not IN the FOR loop - it DEFINES the LOOP. The
LOOP ceases at the extent of the select, i.e. at the first record selected.
So I agree with you Martijn.