Subject Re: [firebird-support] Query is not returning the correct records
Author André Knappstein, Controlling
~~~Ihre Nachricht~~~

RS> AS
RS> DECLARE VARIABLE RATE TYPE OF PERCENTAGE;
RS> BEGIN
RS> /* given an amount and a tax rate id, calculates the tax amount */
RS> SELECT RATE FROM V_TAXRATE
RS> WHERE TAXRATEID = :TAXRATEID
RS> INTO :RATE;
RS>
RS> IF (RATE IS NULL) THEN
RS> TAXAMOUNT = 0;


Randall,
I can't explain why this happens, but found that - when I experienced
the same problems - they all went away when I made a habit of
initializing each and every local variable before using it.

Try to explicitely initialize your variable "rate" before the first
"select ... into ..." and see if this helps. I definitely did for me
(FB 1.5.2, no experience with higher versions because I just
initialize all variables always now)

ciao,
André

---