Oracle plsql coalesce function

Page 1

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 non­null 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 non­null 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 IF­THEN­ELSE statement:


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Oracle plsql coalesce function by John Suma - Issuu