IFNULL

The IFNULL function returns the value in an expression that is not NULL; otherwise, it returns a specified value.

Syntax

IFNULL (expression, value)

Remarks

The possible data types of expression must be compatible with the data type of value.

The following table lists the data types of the input arguments for IFNULL.

Data Type of expression

Output Type

BINARY, DATE, DECIMAL, FLOAT, INTEGER, INTERVAL_DAY, INTERVAL_YEAR, NULL, STRING, TIME, TIMESTAMP, XML

Follows the ANSI SQL rules for data type precedence.

Example

SELECT IFNULL (UnitPrice, ‘Request Quote’) 
FROM /shared/examples/ds_orders/products products