Subject Re: [ib-support] SP Problem
Author Helen Borrie
At 05:02 PM 7/03/2003 +0100, you wrote:
>Hi,
>I wrote a SP, which worked fine. Then I changed it, and now I recieve always
>ANZAHL=0. The 1. SP had no input parameters. I used always 'TODAY' for
>comparison. Here is the new SP:
>
>ALTER PROCEDURE "MITARB_COUNT"
>(
> "STICHTAG2" TIMESTAMP,
> "STICHTAG1" TIMESTAMP
>)
>RETURNS
>(
> "ANZAHL" INTEGER
>)
>AS
>DECLARE VARIABLE MAID INT;
>BEGIN
> ANZAHL = 0;
> FOR SELECT MA.PERSONENIDINT FROM MITARBVIEW MA
> WHERE :STICHTAG2 >= (SELECT MAX(EA.EINTRITTSDATUM) FROM
> MITARBEINAUSVIEW
>EA
> WHERE ((EA.MITARBID = MA.PERSONENIDINT)
> AND ((EA.AUSTRITTSDATUM IS NULL) OR (EA.AUSTRITTSDATUM >=
>:STICHTAG1))))
> INTO :MAID
> DO
> BEGIN
> ANZAHL = ANZAHL + 1;
> END
> SUSPEND;
>END
>
>Thank you for your advices.

It is probable that your tests are still calling the old version of the
procedure, which seems not to have input parameters at all. Changes to SPs
and triggers are deferred in the database, if there are open transactions
in the system that used the old version.

Try shutting down the database server and then restarting it.
Next, test your procedure again and see whether it now works as expected.

If it still doesn't work as expected, then show us an example of how you
are calling this new version of the procedure?

Because date types are involved, it's also necessary to tell us which
dialect you are using.

heLen