DB2 Implied Decimal
Running DB2 8.2 Fixpak 18 for LUW, I need to convert a DECIMAL field to a IMPLIEDDECIMAL for a file export.
I cannot find anythin开发者_运维问答g in the documentation online, please help.
Just multiply the value of the column by 10^scale of the decimal column and convert it to an integer. So, for a DECIMAL(12,4) column: 10^4 = 10000, and:
cast(yourcol * 10000 as bigint)
If a row has a value of 3.1415, this will result in 31415.
精彩评论