oracle常用函數)

來源:互聯網
上載者:User

DECODEDECODE( 1 1 2 2)

IF THEN RETURN()

 

IF THEN RETURN()

                                    ELSE RETURN()

NVLNVL(EXPR1,EXPR2)

EXPR1NULL,EXPR2,EXPR1.

Substr的格式:

substr('This is a test', 6, 2)          would return 'is'
substr('This is a test', 6)              would return 'is a test'

Round 函數 (四捨五入) :

SELECT ROUND( number, [ decimal_places ] ) FROM DUAL
參數:
number : 欲處理之數值
decimal_places : 四捨五入 , 小數取幾位 ( 預設為 0 )

CONCAT

;

     select concat('029-','88888888')||'11'  from dual;

LENGTH

;

select name,length(name),addr,length(addr),sal,length(to_char(sal)) from gao.nchar_tst;

SUBSTR(string,start,count)

,

start,count select substr('13088888888',3,8) from dual;

CEIL

返回大於或等於給出數位最小整數

SQL> select ceil(3.1415927) from dual;

ADD_MONTHS

增加或減去月份

SQL> select to_char(add_months(to_date('199912','yyyymm'),2),'yyyymm') from dual;

LAST_DAY

返回日期的最後一天

 select to_char(sysdate,'yyyy.mm.dd'),to_char((sysdate)+1,'yyyy.mm.dd') from dual;

MONTHS_BETWEEN(date2,date1)

date2-date1

 select months_between('19-12-1999','19-3-1999') mon_between from dual;

NEXT_DAY(date,'day')

select next_day('18-5

SYSDATE

用來得到系統的當前日期

 select to_char(sysdate,'dd-mm-yyyy day') from dual;

TO_CHAR(date,'format')

 select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') from dual;

TO_DATE(string,'format')

TO_NUMBER

將給出的字元轉換為數字

 select to_number('1999') year from dual;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.