Application of NVL, NVL2, NULLIF, and COALESCE functions in oracle

Source: Internet
Author: User
Tags mathematical functions


The NVL, NVL2, NULLIF, and COALESCE functions in oracle are used to apply the string processing penalty, date functions, mathematical functions, and conversion functions previously introduced in Oracle. A type of function is a common function. The primary functions are NVL, NVL2, NULLIF, and COALESCE. These functions can be used in various types. The following describes the usage of several functions. Before introducing this, www.2cto.com must be familiar with oracle null. the NVL function has the following structure: NVL (expr1, expr2) indicates that if the first parameter of oracle is null, the value of the second parameter is displayed, if the value of the first parameter is not blank, the Base Value of the first parameter is displayed. 2 The NVL2 function structure is as follows: NVL2 (expr1, expr2, expr3) indicates that if the value of the first parameter is not empty, the value of the second parameter is displayed, if the first parameter of the function is null, the value of the third parameter is displayed. 3. NULLIF function NULLIF (exp1, expr2) function is if exp1 and exp2 are equal to return NULL (NULL), otherwise return the first value. Www.2cto.com 4. Coalesce function Coalese function is NVL function is a bit similar, the upper hand is more options. The architecture is as follows: Coalesce (expr1, expr2, expr3 ..... Exprn) Coalesce is used to handle these parameters. If the first parameter is null, check whether the second parameter is null. Otherwise, the first parameter is displayed. If the second parameter is null, check whether the third parameter is null, otherwise, the second parameter is displayed, and so on. This function is actually a NVL loop application.

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.