Oracle空值處理函數

來源:互聯網
上載者:User

Oracle空值處理函數

/************Oracle中NUL、NVL2 和NULLIF的用法***************/

NULL指的是空值,或者非法值。

1、NVL(expr1, expr2)函數

expr1為NULL,返回expr2;不為NULL,返回expr1。注意兩者的類型要一致

eg:SELECT NVL(column,0) FROM DUAL --column的值為null,則顯示為0

2、NVL2(expr1, expr2, expr3)

expr1不為NULL,返回expr2;為NULL,返回expr3。expr2和expr3類型不同的話,expr3會轉換為expr2的類型

eg:SELECT NVL2(column,1,0) FROM DUAL --column的值不為null,則顯示為1,若列名的值為null,則顯示為0

3、NULLIF (expr1, expr2) ->expr1和expr2相等返回NULL,不等則返回expr1

Oracle函數之GREATEST函數詳解執行個體

Oracle函數之單行轉換函式

產生動態首碼且自增號碼的Oracle函數

Oracle函數之Replace()

Oracle函數大全

Oracle函數之case和decode的用法區別及效能比較

相關文章

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.