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

What are the constraints available in sql?

683


how to run 'mysql' commands from a batch file? : Sql dba

683


What are sql functions? Describe in brief different types of sql functions?

576


what is the difference between sql and t-sql? : Transact sql

701


Which is better stored procedure or query?

628






what is 'mysqlshow'? : Sql dba

671


Can we create foreign key without primary key?

621


what is a record in a database ? : Sql dba

655


Does pl/sql support create command?

660


what is bdb (berkeleydb)? : Sql dba

672


Is pl sql better than sql?

638


Explain the commit statement.

688


What is the order of sql select?

659


How do I send sql query results to excel?

668


How does left join work in sql?

605