filmov
tv
NVL2 Function in SQL Query

Показать описание
NVL2():
The Oracle NVL2 function extends the functionality found in the NVL function. It lets you substitutes a value when a null value is encountered as well as when a non-null value is encountered.
Syntax:
NVL2( string1, value_if_NOT_null, value_if_null )
Arguments:
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.
Queries used in video:
select ename, NVL2(mgr,'Yes','No Manager') from emp;
select ename,sal,NVL2(comm,'Has some value here','No Value') from emp;
The Oracle NVL2 function extends the functionality found in the NVL function. It lets you substitutes a value when a null value is encountered as well as when a non-null value is encountered.
Syntax:
NVL2( string1, value_if_NOT_null, value_if_null )
Arguments:
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.
Queries used in video:
select ename, NVL2(mgr,'Yes','No Manager') from emp;
select ename,sal,NVL2(comm,'Has some value here','No Value') from emp;