SQL Reference

COALESCE

                                 .------------------.
            (1)                  V                  |
>>-COALESCE-------(--expression-----,--expression---+---)------><
 

Notes:

  1. VALUE is a synonym for COALESCE.

The schema is SYSIBM.

COALESCE returns the first argument that is not null.

The arguments are evaluated in the order in which they are specified, and the result of the function is the first argument that is not null. The result can be null only if all the arguments can be null, and the result is null only if all the arguments are null. The selected argument is converted, if necessary, to the attributes of the result.

The arguments must be compatible. See Rules for Result Data Types for what data types are compatible and the attributes of the result. They can be of either a built-in or user-defined data type. 40

Examples:


Footnotes:

40
This function may not be used as a source function when creating a user-defined function. Since it accepts any compatible data types as arguments, it is not necessary to create additional signatures to support user-defined distinct types.


[ Top of Page | Previous Page | Next Page ]