简体   繁体   English

DB2隐式十进制

[英]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. 运行用于LUW的DB2 8.2 Fixpak 18,我需要将DECIMAL字段转换为IMPLIEDDECIMAL以进行文件导出。

I cannot find anything 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. 只需将列的值乘以十进制列的10 ^标度并将其转换为整数即可。 So, for a DECIMAL(12,4) column: 10^4 = 10000, and: 因此,对于DECIMAL(12,4)列:10 ^ 4 = 10000,并且:

cast(yourcol * 10000 as bigint) 演员表(yourcol * 10000 as bigint)

If a row has a value of 3.1415, this will result in 31415. 如果一行的值为3.1415,则结果为31415。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM