Oracle PL/SQL/Conversion Functions/NULLIF

Материал из SQL эксперт
Перейти к: навигация, поиск

NULLIF() compares two expressions. If they are equal, it returns NULL. Otherwise, it returns the first expression.

 
SQL>
Syntax: NULLIF( <expression1>,<expression2>)
SQL>
SQL> SELECT
  2     NULLIF("ABC","ABC")  equal,
  3     NULLIF ("ABC","DEF") diff from dual;
EQU DIF
--- ---
    ABC



select nullif( 1, 1 )

 
SQL>
SQL> select nullif( 1, 1 )
  2  from dual;
NULLIF(1,1)
-----------

1 row selected.
SQL>
SQL> --



select nullif( 1, null )

 
SQL>
SQL> select nullif( 1, null )
  2  from dual;
NULLIF(1,NULL)
--------------
             1
1 row selected.
SQL>
SQL>
SQL> --