What are the syntax and use of the COALESCE function?

Asked: Apr 14, 2023

The COALESCE() function evaluates the arguments in sequence and returns the first NON-NULL value in a specified number of expressions. If it evaluates arguments as NULL or not found any NON-NULL value, it returns the NULL result.

The syntax of COALESCE function is given below:

  1. COALESCE (exp1, exp2, .... expn)

Example:

  1. SELECT COALESCE(NULL, 'Hello', 'Javatpoint', NULL) AS Result;

This statement will return the following output:

Asked by brijesh

Answers (0)

No answers yet. Be the first to answer!