Declaration
COALESCE(expr, expr, expr,...)
Description
Evaluate each parameter expression in sequence. Stop when a non-NULL value is encountered and return that value. If all expressions evaluate to NULL, a NULL value is returned.
All expressions must be of the same type, or implicitly convertible to the same type.
Examples
obclient> SELECT COALESCE(NULL,NULL,3,4,5), COALESCE(NULL,NULL,NULL);
+---------------------------+--------------------------+
| COALESCE(NULL,NULL,3,4,5) | COALESCE(NULL,NULL,NULL) |
+---------------------------+--------------------------+
| 3 | NULL |
+---------------------------+--------------------------+
1 row in set