COALESCE function

The coalesce function returns the first non-null expression in the list. If all expressions evaluate to null, then the coalesce function returns null. The syntax for the coalesce function is:

coalesce( expr1, expr2, ... expr_n )

You can use the coalesce function in an SQL statement as follows:


SQL> SELECT coalesce( null, '1', null,'2') result FROM dual;

R
-
1

SQL> SELECT coalesce( null, null, null,'2') result FROM dual;

R
-
2

SQL>
Home »
Oracle »
General Functions » 

Related: