Subject RE: [firebird-support] Problem with decimal(6,2) data type of column in Firebird 2.5.0
Author Svein Erling Tysvær
>I use firebird 2.5.0 superserver, and for editing Database Workbech 4.0.3 Lite.
>I have a domain Domain1 with:
>- Datatype: Decimal
>- Lenght: 6
>- Scale: 2
>- Not null: True
>- Default: 0
>I use this domain in multiple calculation.
>But, if i do somme calculation, i.e. Colum1 * Column2, the result Column3 is like 1.456,0587, with four decimals insteed two rounded like 1.456,06.
>So, in my report (using RaveReports) the calculated number like 0,8794 is displayed like ",8794", without leading zero.
>Please help my to resolve that.

If you multiply two numbers with two decimals, then the result must contain four decimals to be precise. If you want it rounded, then you have to tell Firebird to do that. I would typically do CAST(Colum1 * Column2 as DECIMAL(6, 2)), but maybe you can simply do CAST(Colum1 * Column2 as Domain1) - I don't use domains very often and have never tried.

How things are displayed in RaveReports, well, that is a question relating to RaveReports and not Firebird - at least unless you choose to cast the number to CHAR, VARCHAR or similar (i.e. solve a RaveReports problem in Firebird). I assume RaveReports have a property saying whether 0 should be displayed for numbers less than 1, but do not know and this part of your question belongs to some other support forum.