Subject Re: [firebird-support] Store proc calc (rounding) fails
Author Martijn Tonies
Hello 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)

Do you get this error as well if you execute the procedure, not from the
debugger but "normally"?

Oh yeah, and upgrade Database Workbench to 2.7.5 - it's a free upgrade.

> 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....???

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com