Oracle null value processing function

Source: Internet
Author: User

Oracle null value processing function

/*********** NUL, NVL2, and NULLIF usage in Oracle ***************/

NULL indicates a NULL value or an invalid value.

1. NVL (expr1, expr2) Function

If expr1 is NULL, expr2 is returned. If not NULL, expr1 is returned. Note that the two types must be consistent.

Eg: select nvl (column, 0) from dual -- the value of column is null, and 0 is displayed.

2. NVL2 (expr1, expr2, expr3)

If expr1 is not NULL, expr2 is returned. If it is NULL, expr3 is returned. If the expr2 and expr3 types are different, expr3 will be converted to the expr2 type.

Eg: SELECT NVL2 (column,) from dual -- the column value is not null, and 1 is displayed. If the column name value is null, 0 is displayed.

3. NULLIF (expr1, expr2)-> equal to expr1 and expr2 return NULL, otherwise expr1 is returned.

Detailed examples of Oracle function GREATEST Functions

Single-row conversion functions of Oracle Functions

Oracle functions that generate dynamic prefixes and auto-increment numbers

Replace () for Oracle Functions ()

Oracle Functions

Differences in case and decode usage and Performance Comparison of Oracle Functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.