Oracle round函数用法

  • Post author:
  • Post category:其他




Oracle round函数用法

如何使用 Oracle Round 函数 (四舍五入)

描述 : 传回一个数值,该数值是按照指定的小数位元数进行四舍五入运算的结果。

SELECT ROUND( number, [ decimal_places ] ) FROM DUAL

参数:

number : 欲处理之数值

decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 )

Sample :

select round(123.456, 0) from dual; 回传 123

select round(123.456, 1) from dual; 回传 123.5

select round(123.456, 2) from dual; 回传 123.46

select round(123.456, 3) from dual; 回传 123.456

select round(-123.456, 2) from dual; 回传 -123.46



版权声明:本文为weixin_43564627原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。