Oracle 10g 浮点格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2127649/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle 10g Float format
提问by v14nt0
How can I return from float/decimal value with the following:
如何从浮点/十进制值返回以下内容:
SELECT 210
FROM DUAL
...to get:
...要得到:
210.00
...instead of 210
?
...而不是210
?
Using pl/sql oracle 10g
使用 pl/sql oracle 10g
回答by gregseth
回答by OMG Ponies
回答by Dave7896
You can use the to_char function passing in an optional format string e.g. to_char(210.00,'000.00') would give the desired result. Do a google search for "number formatting in oracle" and you will find some good examples of format strings.
您可以使用传递可选格式字符串的 to_char 函数,例如 to_char(210.00,'000.00') 将给出所需的结果。用谷歌搜索“oracle 中的数字格式”,你会发现一些格式字符串的好例子。
EditLook for "Number Format Elements" here.
在这里编辑查找“数字格式元素” 。