Search notes:

SQL: coalesce

The expression coalesce(p1, p2, … pₙ) evaluates to the first parameter (pₓ) that is not null.

Recursive definition of coalesce

The SQL expression coalesce can be defined recursively:
coalesce(p1, p2) is equivalent to the following case expression:
case
   when p1 is not null then p1
   else                     p2
end
coalesce(p1, p2, … pₙ) is equivalent to
case
   when p1 is not null then p1
   else coalesce(p₂, … pₙ)
end

Index