ORACLE常用函式

2021-07-26 05:40:01 字數 1954 閱讀 7743

1.絕對值:abs()

select abs(-2) value from dual;

2.取整函式(大):ceil()

select ceil(-2.001) value from dual;(-2)

3.取整函式(小):floor()

select floor(-2.001) value from dual;(-3)

4.取整函式(擷取):trunc()

select trunc(-2.001) value from dual; (-2)

5.四捨五入:round()

select round(1.234564) value from dual;(1.2346)

6.取平方:power(m,n)

select power(4,2) value from dual;(16)

7.取平方根:sqrt()

select sqrt(16) value from dual;(4)

8.取隨機數:dbms_random(minvalue,maxvalue)

select sys.dbms.random.value(0,1) value from dual;

9.取符號:sign()

select sign(-3) value from dual;(-)

10,取集合的最大值:greatest(value)

select greatest(-1,3,5,7,9) value from dual;(9)

11.取集合的最小值:least(value)

select least(-1,3,5,7,9) value from dual;(-1)

12.處理null值:nvl(空值,代替值)

select  nvl(null,10) value from dual;(10)

13.求字元序號:ascii()

select ascii(a) value from dual;

14.求序號字元:chr()

select chr(97) value from dual;

select concat("11","22") value from dual;(1122)

select sysdate value from dual;

17.求日期

select trunc(sysdate) from dual;

18.求時間

select  to_char(sysdate,"hh24:mm:ss") from dual;

19.首字母大寫:initcap()

select initcap(abc def ghi) value from dual;(abc def ghi)

Oracle常用函式

一 row number over 資料甲 1 select column name column name,data type,2 row number over partition by column name order by column name row num 3 from test c...

Oracle常用函式

數學函式 1.絕對值 o select abs 1 value from dual 2.取整 大 o select ceil 1.001 value from dual 3.取整 小 o select floor 1.001 value from dual 4.取整 擷取 o select trun...

oracle常用函式

1.concat c1,c2均為字串,函式將c2連線到c1的後面,如果c1為null,將返回c2.如果c2為null,則返回c1,如果c1 c2都為null,則返回null。他和操作符 返回的結果相同 select concat slobo svoboda username from dualuse...