Subject RE: [firebird-support] Arithmetic overflow or division by zero has occurred.
Author Svein Erling Tysvær
>SELECT cast((5411.000455/0.000020) as numeric(16,6)) as mount FROM MON$ATTACHMENTS r

This particular query can be rewritten as

SELECT 5411.000455*cast(1/0.000020 as integer) as mount FROM MON$ATTACHMENTS r

Though it will not work equally well with other numbers, at least not if cast(1/0.xxxxxx as numeric(16, 4)) doesn't yield sufficient precision when doing 5411.000455*ResultFromAbove.

HTH,
Set