ORACLE/PLSQL: COALESCE FUNCTION This Oracle tutorial explains how to use the Oracle/PLSQL COALESCE functionwith syntax and examples.
DESCRIPTION The Oracle/PLSQL COALESCE function returns the first nonnull expression in the list. If all expressions evaluate to null, then the COALESCE function will return null.
SYNTAX The syntax for the Oracle/PLSQL COALESCE function is: COALESCE( expr1, expr2, ... expr_n )
Parameters or Arguments expr1 to expr_n are the expressions to test for nonnull values.
APPLIES TO The COALESCE function can be used in the following versions of Oracle/PLSQL: Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i
EXAMPLE The COALESCE function can be used in Oracle/PLSQL. You could use the coalesce function in a SQL statement as follows: SELECT COALESCE( address1, address2, address3 ) result FROM suppliers;
The above COALESCE function is equivalent to the following IFTHENELSE statement: