real time applications of nullif?

Answer Posted / avi007

In Oracle/PLSQL, the NULLIF function compares expr1 and
expr2. If expr1 and expr2 are equal, the NULLIF function
returns NULL. Otherwise, it returns expr1.

The syntax for the NULLIF function is:

NULLIF( expr1, expr2 )

expr1 and expr2 must be either numeric values or values
that are of the same datatype.

For example:

NULLIF(12, 12) would return NULL
NULLIF(12, 13) would return 12
NULLIF('apples', 'apples') would return NULL
NULLIF('apples', 'oranges') would return 'apples'
NULLIF(NULL, 12) would return an ORA-00932 error because
expr1 can not be the literal NULL

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is %isopen always false for an implicit cursor?

564


Is a view faster than a stored procedure?

542


What is an escape character in sql?

558


When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?

623


How can I tell if sql is running?

579






Is pl sql still used?

503


What is meant by user defined function?

575


What is database sql?

537


Can you selectively load only those records that you need? : aql loader

605


What are the different types of functions in sql?

510


Does sql*plus have a pl/sql engine?

561


What is sql dialect?

522


What is the most restrictive isolation level? : Transact sql

548


What is difference between hql and native sql?

571


What is varchar data type in sql?

512