NULLIF function

NULLIF is a newly added function in Oracle 9i.

The format is as follows:

    NULLIF(expression1, expression2)

    The NULLIF function compares expression1 and expression2.

    Returns NULL if the two expressions are equal.

    Returns expression1 if not equal.

 

E.g:

SELECT NAME,JOB,NULLIF(LENGTH(NAME),LENGTH(JOB)) FROM EMP;

When LENGTH(NAME) and LENGTH(JOB) are equal, the function NULLIF(LENGTH(NAME), LENGTH(JOB)) returns null.

Otherwise, return the value of LENGTH(NAME), which is the length of NAME.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326351766&siteId=291194637