Skip to main content


Returns the first argument which is not NULL from a series of two or more arguments, can be used to substitute a default value for a NULL value.

The COALESCE function is equivalent to the NVL function in Oracle or the IFNULL function in MySQL.

See also:


SELECT COALESCE(expression1, expression2 [, ..]) FROM <multipartIdentifier>;


Two or more expressions of any data type which resolve to a NULL or non NULL value.

If all of the expression arguments are NULL, the COALESCE function returns NULL.

Return Value(s)

Returns the first non NULL value from the series of expression arguments.


Replace a NULL value with a default value

SELECT name, coalesce(website, cors, 'not hosting shared resources') AS website_or_cors_config
FROM where project = 'stackql';

For more information, see