Decimal data type conversion differences between DB2 ORACLE mode and ORACLE
WoongChoi 505V5WD6N5 Visits (7168)
When you convert a value to decimal data type in DB2 ORACLE mode, you will see that the conversion follows different rule from ORACLE.
1. DB2 ORACLE mode : decflt_rounding in database cfg
And default value for decflt_rounding is ROUND_HALF_EVEN in DB2. So you will see different results if you just set
For better understanding, let me compare the same examples between two.
1. DB2 ORACLE mode
DB2 ORACLE mode will follow the
$ db2 -x "val
ORACLE uses ROUND_HALF_UP. Different from simple ROUND, both data type uses ROUND_HALF_UP for decimal conversion.
(For ROUND, please check the following link attached below)
SQL> select cast (12.345 as decimal(5,2)) from dual;
SQL> select cast (12.345f as decimal(5,2)) from dual;
For more information about this issue, please refer to the following links.
decflt_rounding - Decimal floating point rounding configuration parameter
ORACLE ROUND function