Subject | Re: [firebird-support] What is wrong with this SP? (BIGINT range) |
---|---|
Author | Helen Borrie |
Post date | 2006-04-10T13:12:31Z |
At 10:34 PM 10/04/2006, you wrote:
multiple rows. Are you expecting to get a sum on every row? That's
illogical. If you want to aggregate ULAZ and IZLAZ, then SUM() is
not what you want here. You would need to accumulate them
respectively into R_ULAZ_SUM and R_IZLAZ_SUM.
2. What *are* the correct values?
3. What are the data types of ULAZ and IZLAZ?
./heLen
>Hello group,1. What is the intended logic here? A FOR SELECT loop processes
>
>I'll try to be as simple as possible. Why the SP below returns 504995,
>504995? Select statement itself returns correct values ...
>
>/*SUM*/
>CREATE PROCEDURE SP_SUM_BLAGAJNA_BY_DATE
>(
> P_START_DATE DATE,
> P_END_DATE DATE,
> P_WHICH INT
>)
>RETURNS
>(
> R_ULAZ_SUM BIGINT,
> R_IZLAZ_SUM BIGINT
>)
>AS
>BEGIN
> FOR
> SELECT SUM(BLAGAJNA.ULAZ), SUM(BLAGAJNA.IZLAZ)
> FROM BLAGAJNA
> WHERE BLAGAJNA.DATUM BETWEEN :P_START_DATE AND :P_END_DATE
> AND BLAGAJNA.WHICH = :P_WHICH
> INTO :R_ULAZ_SUM, :R_IZLAZ_SUM
> DO
> SUSPEND;
>END
multiple rows. Are you expecting to get a sum on every row? That's
illogical. If you want to aggregate ULAZ and IZLAZ, then SUM() is
not what you want here. You would need to accumulate them
respectively into R_ULAZ_SUM and R_IZLAZ_SUM.
2. What *are* the correct values?
3. What are the data types of ULAZ and IZLAZ?
./heLen