Subject Re: [firebird-support] Query is not returning the correct records
Author Randall Sell
Well I tried your advise. And to my surprise, when I tested it - it worked! But don't get too excited, after hours more of investigation on the topic, as it turns out, it was a problem with the server. Once I restarted FB, all came good again and order was restored to the universe.

But thanx the advise on good practice. I will keep it in mind.

-rs





________________________________
From: "André Knappstein, Controlling" <Knappstein@...>
To: Randall Sell <firebird-support@yahoogroups.com>
Sent: Thu, 6 May, 2010 6:32:24 PM
Subject: Re: [firebird-support] Query is not returning the correct records



~~~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é

---






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