我想這樣做,請ROUND SQL
select round(9.100000, 3) from dual
結果= 9.100
select round(12679.1000001, 3) from dual
結果= 12679.100
感謝
我想這樣做,請ROUND SQL
select round(9.100000, 3) from dual
結果= 9.100
select round(12679.1000001, 3) from dual
結果= 12679.100
感謝
你可以做到這一點to_char
方法:
select to_char(9.100000, '999.999') from dual
select to_char(12679.1000001, '99999.999') from dual
例有一張桌子,而不是常數值:
with temp as (
select 9.100000 as num from dual
union
select 12679.1000001 as num from dual
union
select -20.2356 as num from dual
)
select to_char(num,'99999.999') from temp
你怎麼知道OP想要字符串作爲輸出? –
預期的結果沒有任何意義(IMHO)... –
@GrishaWeintraub謝謝,我現在看到它+1 :-) –
你的查詢已經四捨五入正確。那麼你的問題是什麼? –