COALESCE( )

From InterBase

Go Up to Statement and Function Reference (Language Reference Guide)


The COALESCE function evaluates to the first value expression in a list that evaluates to non-NULL. If none of the value expressions in the list evaluates to non-NULL, then the COALESCE expression evaluates to NULL.

 COALESCE(<expression1>,<expression2>,...<expression_n>)

Description: The COALESCE and NULLIF expressions are common, shorthand forms of use for the CASE expression involving the NULL state. A COALESCE expression consists of a list of value expressions. It evaluates to the first value expression in the list that evaluates to non-NULL. If none of the value expressions in the list evaluates to non-NULL, then the COALESCE expression evaluates to NULL.

Example: The following example demonstrates the use of CASE using the sample employee.ib database:

select coalesce(department, head_dept, location) from department

Advance To: