oracle--函數

來源:互聯網
上載者:User

標籤:code   ram   數列   系統   lead   char   ace   from   串連   

函數1、數值函數(1)Ceil(n)

返回大於或等於n的最小整數

(2)Power(m,n)

返回m的n次方

(3)Trunc(m[,n])

對m截取操作,當n大於0時,表示截取到小數點右邊第n位;當n省略時,表截取m的小數部分;當n小於0時,表示截取到小數點左側第n位

 

2、字元函數(1)Concat((char1,char2)

用於字元串連,返回字串char2與字串char1串連後的字串

(2)Instr(char1,char2,[m[,n]])

返回指定字串char2在char1中的位置,其中m表示起始搜尋位置,n表示字串char2在字串char1中出現的次數。

(3)Lpad(char1,n[,char2])

在字串char1左側填充字串char2使其長度達到n。若字串char1長度大於n,則返回字串char1左側的n個字元

(4)Replace(char1,char2,char3)

把字串char1中的字串char2用字串char3取代

(5)Substr(char,m[,n])

用於擷取字串char的子串,m表示子串的起始位置,n表示子串的長度

(6)Trim([leading|trailing|both]char FROM string)

從字串的頭、尾貨兩端截掉字元char

 

3、日期函數(1)Months_between(d1,d2)

返回d1和d2兩個日期之間相差的月數

(2)Sysdate

返回當前系統的日期時間

(3)To_char(d,[,fmt][,’nlsparam’])

將日期時間轉換為特定格式的字串

(4)To_date(char[,fmt][,’nlsparam’])

將符合特定格式的字串char轉換為日期

 

4、轉換函式(1)Cast(expr AS datatype)

將運算式按指定的類型返回

(2)To_char(char)(3)To_number(char[,fmt][,’nlsparam’])

將符合特定格式的字串char轉換為數值

5、其他函數(1)Decode()

形式:decode(expr,search1,result1[,search2,result2,…][,default])

說明:如果search1=expr,返回result1,如果search2=expr,則返回result2,以此類推。

(2)Nvl()

形式:nvl(expr1,expr2)

說明:若expr1為null,則返回expr2,否則返回expr1

(3)Nvl2()

形式:Nvl2(expr1,expr2,expr3)

說明:若expr1為null,則返回expr3,否則返回expr2

(4)Nullif()

形式:nullif(expr1,expr2)

說明:若expr1與expr2相等則返回null,否則返回expr1

(5)Greatest()

形式:greatest(expr1,expr2,…)

說明:返回幾個運算式中的最大值

(6)Least()

Least(expr1,expr2,…)

返回幾個運算式中的最小值

 

(7)Coalesce(expr1,[,expr2][,expr3]…)

返回參數列表中第一個非空運算式的結果

 

oracle--函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.