Difference between NVL, NVL2 and NULLIF



Difference between NVL, NVL2 and NULLIF..

Answer / sushma s

NVL function substitute a value when a null value is
encountered.
NVL2: substitutes a value when a null value is encountered
as well as when a non-null value is encountered.

The syntax for the NVL2 function is:

NVL2( string1, value_if_NOT_null, value_if_null )

string1 is the string to test for a null value.

value_if_NOT_null is the value returned if string1 is not null.

value_if_null is the value returned if string1 is null.

NULLIF: NULLIF function compares expr1 and expr2. If expr1
and expr2 are equal, the NULLIF function returns NULL.
Otherwise, it returns expr1.

Is This Answer Correct ?    64 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

Why use triggers in sql?

0 Answers  


What are its different types of dbms?

0 Answers  


Suppose There is a string A.B....C.......D.........E........F In this string dots (.) are not having fixed count in between of string. I want the output to have string with one dot between. I.e. A.B.C.D.E.F

6 Answers   IBM,


what is 'mysqlimport'? : Sql dba

0 Answers  


Can we rollback truncate?

0 Answers  






Explain aggregate functions are available there in sql?

0 Answers  


What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?

4 Answers  


is mysql query is case sensitive? : Sql dba

0 Answers  


How to Execute a Package in PL/SQL.?

0 Answers   MCN Solutions,


What is a schema sql?

0 Answers  


How can I see all tables in sql?

0 Answers  


What is dynamic sql in pl sql?

0 Answers  


Categories