将结果集仅保留为4位数字时,我遇到问题。
我尝试四舍五入,截断和投射,但没有得到想要的结果
trunc(stg4.std_deviation/NULLIF(stg4.avg_sls_13,0) * 100,4) as CV1,
round((stg4.std_deviation/NULLIF(stg4.avg_sls_13,0)) * 100,4) as CV2,
round(stg4.std_deviation,4)/NULLIF(round(stg4.avg_sls_13,4),0) * 100 as CV3
CV1的结果是-6.27052173913043E41
CV2的结果是-6.27052173913043E41
CV3的结果为NULL
我想要的结果将是最接近该列的NUMBER(12,4)个数据类型的数字
答案 0 :(得分:0)
TO_CHAR
是否可以提供科学符号帮助?
SQL> with temp (col) as
2 (select -6.27052173913043E41 from dual)
3 select to_char(col, '9d0000EEEE') result
4 from temp;
RESULT
------------
-6,2705E+41
SQL>