Technical Blog Post
Abstract
Approximation error in decimal data type conversion in oracle mode
Body
When oracle mode is used in db2, you might see the approximation error when you convert a value to decimal data type while original DB2 does not make this error. This is because the oracle mode follows the decflt_rounding from database cfg which would have an approximation error.
Please check the following example which shows difference between original db2 and oracle mode.
-------------------------------------------
SQL: db2 -x "values decimal(double(0.1),31,20)"
oracle mode output: 0.10000000000000001000
db2 mode output: 0.10000000000000000000
-------------------------------------------
As you can see, oracle mode shows the approximation error.
For db2 conversion rule, please check the following links for detail.
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
UID
ibm13286239