16.20 - COALESCE Expression - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

Purpose

Returns NULL if all its arguments evaluate to null. Otherwise, it returns the value of the first non-null argument in the scalar_expression list.

COALESCE is a shorthand expression for the following full CASE expression:

   CASE 
    WHEN  scalar_expression_1  IS NOT NULL 
    THEN  scalar_expression_1  
    ...
    WHEN  scalar_expression_n  IS NOT NULL 
    THEN  scalar_expression_n  
    ELSE NULL 
   END

Syntax