Nvl2

From Oracle FAQ
Jump to: navigation, search

NVL2 is an Oracle SQL function that will return different values based on whether the input value is NULL or not.

Syntax:

NVL2(input_value, return_if_not_null, return_if_null)

NVL2(a,b,c) == if 'a' is not null then return 'b' else return 'c'.

[edit] Examples

SELECT nvl2(ename, 'Do have a name', 'No Name') FROM emp;

[edit] Also see

Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #