Subject | Store proc calc (rounding) fails |
---|---|
Author | John B. Moore |
Post date | 2005-10-31T01:17:49Z |
Greetings,
This was a stored procedure that worked in Interbase 6 (open source)
and is failing in Firebird.. There may be several issues but I'll hit
them one-at-a-time.. (from debugging in Database Workbench 2.6)
The following line fails with the error
"Array/BLOB/Date not allowed in arithmetic..."
update TMP_FINANCE_CALC
set FINANCE_CHG = (CAST( ((BALANCE * :IN_RATE )*100) AS INTEGER))/100;
The intention was to round the field to a two place decimal. The
field FINANCE_CHG is Double Precision, as is the BALANCE field as well
as the input parameter IN_RATE.
The statement works IF I remove the input parameter as in
update TMP_FINANCE_CALC
set FINANCE_CHG = (CAST( ((BALANCE * 0.018 )*100) AS INTEGER))/100;
I need to have that input parameter in the calculation..
I have a similar statement later in the procedure that is also
failing.. (probably for the same reasons..)
L_FINANCE_CHG = ( CAST((L_FINANCE_CHG * 100) AS INTEGER) )/100;
where L_FINANCE_CHG is a declared variable as a Double Precision.
Suggestions, Ideas, kick in the pants....???
John
This was a stored procedure that worked in Interbase 6 (open source)
and is failing in Firebird.. There may be several issues but I'll hit
them one-at-a-time.. (from debugging in Database Workbench 2.6)
The following line fails with the error
"Array/BLOB/Date not allowed in arithmetic..."
update TMP_FINANCE_CALC
set FINANCE_CHG = (CAST( ((BALANCE * :IN_RATE )*100) AS INTEGER))/100;
The intention was to round the field to a two place decimal. The
field FINANCE_CHG is Double Precision, as is the BALANCE field as well
as the input parameter IN_RATE.
The statement works IF I remove the input parameter as in
update TMP_FINANCE_CALC
set FINANCE_CHG = (CAST( ((BALANCE * 0.018 )*100) AS INTEGER))/100;
I need to have that input parameter in the calculation..
I have a similar statement later in the procedure that is also
failing.. (probably for the same reasons..)
L_FINANCE_CHG = ( CAST((L_FINANCE_CHG * 100) AS INTEGER) )/100;
where L_FINANCE_CHG is a declared variable as a Double Precision.
Suggestions, Ideas, kick in the pants....???
John