ORACLE中的ROUND函数
来源:互联网 发布:多元高斯分布知乎 编辑:程序博客网 时间:2024/04/29 12:16
ROUND (number)
语法
用法
ROUND
returns n
rounded tointeger
places to the right of the decimal point. If you omitinteger
, then n
is rounded to 0 places. The argumentinteger
can be negative to round off digits left of the decimal point.
n
can be any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The argumentinteger
must be an integer. If you omitinteger
, then the function returns the same datatype as the numeric datatype of the argument. If you includeinteger
, then the function returnsNUMBER
.
For NUMBER
values, the value n
is rounded away from 0 (for example, tox
+1 whenx
.5 is positive and tox
-1 whenx
.5 is negative).(数值数据精确到离0更远的那一端) ForBINARY_FLOAT
andBINARY_DOUBLE
values, the function rounds to the nearest even value. (单精度浮点数或双精度浮点数精确到最近的偶数)Please refer to the examples that follow.
范例
The following example rounds a number to one decimal point(精确到一位小数):
SELECT ROUND(15.193,1), ROUND(-15.193,1) FROM DUAL;
ROUND(15.193,1) ROUND(-15.193,1)
--------------- ----------------
15.2 -15.2
SELECT ROUND(15.149,1), ROUND(-15.149,1) FROM DUAL;
ROUND(15.149,1) ROUND(-15.149,1)
--------------- ----------------
15.1 -15.1
The following example rounds a number one digit to the left of the decimal point(精确到十位):
SELECT ROUND(15.193,-1) "Round" FROM DUAL;
Round
----------
20
SELECT ROUND(14.999, -1) "Round" FROM DUAL;
Round
----------
10
The following examples illustrate the difference between rounding NUMBER and floating-point number values.NUMBER values are rounded up (for positive values), whereas floating-point numbers are rounded toward the nearest even value(数值数据精确到离0更远的那一端,单精度浮点数或双精度浮点数精确到最近的偶数):
SELECT ROUND(1.5), ROUND(2.5) FROM DUAL;
ROUND(1.5) ROUND(2.5)
---------- ----------
2 3
SELECT ROUND(1.5f), ROUND(2.5f) FROM DUAL;
ROUND(1.5F) ROUND(2.5F)
----------- -----------
2.0E+000 2.0E+000
以下为自测部分:
SELECT ROUND(-1.55, 1), ROUND(1.55, 1) FROM DUAL;
ROUND(-1.55,1) ROUND(1.55,1)
-------------- -------------
-1.6 1.6
SELECT ROUND(-1.55f, 1), ROUND(1.55f, 1) FROM DUAL;
ROUND(-1.55F,1) ROUND(1.55F,1)
--------------- --------------
-1.5 1.5
- ORACLE中的ROUND函数
- Oracle中的Round函数
- Oracle中的Round和Trunc函数区别
- Oracle中的ROUND( )日期四舍五入函数
- oracle中的turnc,round,floor,ceil,coalesce函数
- oracle Round( ) 函数
- Oracle 的 Round函数
- Oracle round 函数(四舍五入)
- Oracle--Round函数
- oracle中的round(date)
- MATLAB中的round函数
- MATLAB中的round函数
- MATLAB中的round函数
- SQL中的ROUND函数
- mysql中的round函数
- mysql中的round函数
- oracle round函数的使用方法
- oracle之round函数使用
- 工作流工时统计
- Best Time to Buy and Sell Stock III
- 黑马程序员_其他对象
- java初学者,对环境变量设置的学习
- InstallShield2010 Basic MSI Project 学习笔记
- ORACLE中的ROUND函数
- Android UI开发第三十篇——使用Fragment构建灵活的桌面
- 变量 (程序设计)
- Android Virtual Device Manager失去响应后,被强制关闭,之后无法打开Android Virtual Device Manager
- Activity的启动模式
- Android Handler+Thread实现更新Ui
- 【网上陷阱多 IE浏览器分级审查很重要】
- windows常用快捷键
- iOS开发之邮件发送代码