Oracle PL/SQL/Conversion Functions/COALESCE

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

COALESCE() returns the first non-null expression in the expression list

 
Syntax: COALESCE (<exp1>,<exp2> . . . <expN>)
SQL>
SQL> SELECT COALESCE (NULL, NULL, "NOT NULL", NULL) test from dual;
TEST
--------
NOT NULL
SQL>
SQL>



select coalesce( null, "", "A" )

 
SQL>
SQL> select coalesce( null, "", "A" )
  2  from dual;
C
-
A
1 row selected.
SQL>
SQL> --



select coalesce( null, sysdate )

 
SQL>
SQL> select coalesce( null, sysdate )
  2  from dual;
COALESCE(
---------
16-JUN-08
1 row selected.
SQL>
SQL>
SQL> --