Home  >  Article  >  Database  >  Oracle基础教程:单行函数—数值类型函数

Oracle基础教程:单行函数—数值类型函数

WBOY
WBOYOriginal
2016-06-07 17:11:40916browse

数值型函数 ROUND TRUNC MOD CEIL power ROUND(列名|表达式,n)四舍五入到小数点后的n位idlegt; select round(458.734,0),round(

数值型函数
 ROUND
 TRUNC
 MOD
 CEIL
 power
ROUND(列名|表达式,n)
四舍五入到小数点后的n位
idle> select round(458.734,0),round(458.734,1),round(458.734,-1) from dual;

ROUND(458.734,0) ROUND(458.734,1) ROUND(458.734,-1)
---------------- ---------------- -----------------
      459     458.7  460

idle>

TRUNC(列名|表达式,n)
截取到小数点后的n位
idle> select trunc(458.734,0),trunc(458.734,1),trunc(458.734,-1) from dual


TRUNC(458.734,0) TRUNC(458.734,1) TRUNC(458.734,-1)
---------------- ---------------- -----------------
      458     458.7  450

idle>


MOD(m,n)
求m除以n的余数
idle> select mod(10,3) from dual;

 MOD(10,3)
----------
  1

idle>
idle> select mod(3,10) from dual;

 MOD(3,10)
----------
  3

idle>

CEIL 取整 向上补1  和trunc相反
idle> select ceil(457.001) from dual;   后面只要有小数,就进一

CEIL(457.001)
-------------
   458

idle>


power(底数,指数) 求次方

SQL> select power(10,3) from dual;

POWER(10,3)
-----------
       1000

SQL>

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn