- 論壇徽章:
- 3
|
你這里說的“有效數(shù)字”不是大家都理解的有效數(shù)字,有效數(shù)字中0也包括的,使用trunc函數(shù)就可以了,而你說的這種“有效數(shù)字”估計必須自己寫一個函數(shù)實現(xiàn)了。
大家都能理解的有效數(shù)據(jù)使用trunc的處理:
osdba=# select trunc(1.1,2);
trunc
-------
1.10
(1 row)
osdba=# select trunc(1.123,2);
trunc
-------
1.12
(1 row)
osdba=# select trunc(1.0001,3);
trunc
-------
1.000
(1 row)
osdba=# select trunc(1.0001,4);
trunc
--------
1.0001
(1 row)
osdba=# select trunc(1.000123,6);
trunc
----------
1.000123
(1 row)
osdba=# select trunc(1.000123,5);
trunc
---------
1.00012
|
|