ETL开发项目中遇到过一个很奇特的问题,源表的主键是number类型,精度大于15,抽取到目标表的过程中,通过debugger调试器查看会生成科学计数法的格式,workflow运行完成后,主键相差很小的数字结果却变成了很多相同的数字,然后程序报主键重复错误,当时也走了很多弯路,花了好长时间去解决这个问题。
原因:没有启用高精度
解决办法:可以在Task的Properties页签中勾选“Enable high precision”单选框,截图如下:
原因分析:
最权威的资料当属F1帮助文档,在索引处输入“high precision, handling”,结果如下:
High Precision Data Overview
High precision data determines how large numbers are represented with greater accuracy. The precision attributed to a number includes the scale of the number. For example, the value 11.47 has a precision of 4 and a scale of 2. Large numbers can lose accuracy because of rounding when used in a calculation that produces an overflow. Incorrect results may arise because of a failure to truncate the high precision data.
High precision data values have greater accuracy. Enable high precision if you require accurate values.
You enable high precision on the properties tab of the session. The Integration Service processes high precision data differently for bigint and decimal values.
Bigint
In calculations that can produce decimal values, the Integration Service processes bigint values as doubles or decimals. When a session contains a calculation that can produce decimal values and runs without high precision, the Integration Service converts bigint values to doubles before it performs the calculation. The transformation Double datatype supports precision of up to 15 digits, while the Bigint datatype supports precision of up to 19 digits. Therefore, precision loss can occur in calculations that produce bigint values with precision of more t