Subject Re: [firebird-support] What is wrong with this SP? (BIGINT range)
Author Velja Radenkovic
On 4/10/06, Helen Borrie <helebor@...> wrote:
>
> No. To get a one-row result you use the SELECT ..... INTO
> <variables> syntax. FOR SELECT gets multiple rows in a loop and
> operates on each row one by one.


It seams that the correct statement is:
FOR SELECT gets N rows i.e. 0, 1 or more in a loop and
operates on each row one by one. If SELECT SUM(ULAZ), SUM(IZLAZ) ... returns
as one row
----------------------------------------------------------------------------
SUM_OF_ULAZ_VALS | SUM_OF_IZLAZ_VALS
----------------------------------------------------------------------------

FOR will pass through only once.

>2. Correct results are much bigger. The SUM of any 10 values is larger than
> >above.
>
> With you syntax, you would be getting the values of the last row
> processed. SUM(ONE_VALUE) should return some kind of exception, but
> apparently not if it worked for you.



I'm assuming that my stmt is correct because I got very correct results and
got them very fast on multiple SPs with "missused" FOR loop.

Off course, I'll correct the SPs to use SELECT INTO syntax but wanted share
my results here.

Velja


[Non-text portions of this message have been removed]