Table of ContentsPreviousNext

Database Migration


COALESCE

Syntax

COALESCE(expr, expr2 {, expr })

COALESCE returns the first argument that is not NULL. The arguments are evaluated in the order in which they are specified. This function is usually used to replace NULL values with a not NULL value.

Example

This example selects title and price for all books. If the price for a given title is NULL, the price shown is 0.00.

SELECT title, COALESCE(price, 0.00) AS price
FROM titles;

TABLE 65. Equivalents in other databases
Oracle
NVL function
Microsoft SQL Server
COALESCE and ISNULL functions


Ispirer Systems
http://www.ispirer.com
ispirer@ispirer.com
Table of ContentsPreviousNext