Which statement is true regarding the COALESCE function?

Which statement is true regarding the COALESCE function?

Which statement is true regarding the COALESCE function?

A.
It can have a maximum of five expressions in a list.

B.
It returns the highest NOT NULL value in the list for all rows.

C.
It requires that all expressions in the list must be of the same data type.

D.
It requires that at least one of the expressions in the list must have a NOT NULL value.

Explanation:
The COALESCE Function
The COALESCE function returns the first nonnull value from its parameter list. If all its parameters
are null, then null is returned.
The COALESCE function takes two mandatory parameters and any number of optional
parameters. The syntax is COALESCE(expr1, expr2,,exprn), where expr1 is returned if it is not
null, else expr2 if it is not null, and so on. COALESCE is a general form of the NVL function, as the
following two equations illustrate:
COALESCE(expr1,expr2) = NVL(expr1,expr2)
COALESCE(expr1,expr2,expr3) = NVL(expr1,NVL(expr2,expr3))
The data type COALESCE returns if a not null value is found is the same as that of the first not
null parameter.
To avoid an ORA-00932: inconsistent data types error, all not null parameters must have data
types compatible with the first not null parameter.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Md Abdul Halim

Md Abdul Halim

Answer is C . It requires that all expressions in the list must be of the same data type .