COALESCE function (SQL)

Introduction

The SQL COALESCE function selects the first non-NULL parameter.

Syntax

primary-coalesce ::=
  COALESCE ( value-expression [ { , value-expression } ] )

Remarks

Each parameter to the COALESCE function is evaluated until the first non-NULL value. The first non-NULL value is returned. If all of the parameters to the COALESCE function are NULL, the return value is NULL.

The types of the parameters to the COALESCE function must be compatible. The return type is the highest precedence of the parameters. For example if the parameters to the COALESCE function are TinyInt, Integer and Real, the return type will be Real.

Further Information

Value Expressions (SQL)

To learn more about SQL scalar value expressions.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.