nerdexam
Oracle

1Z0-061 · Question #192

Which statement is true regarding the COALESCE function?

The correct answer is C. It requires that all expressions in the list must be of the same data type. 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…

Using Conversion Functions and Conditional Expressions

Question

Which statement is true regarding the COALESCE function?

Options

  • AIt can have a maximum of five expressions in a list.
  • BIt returns the highest NOT NULL value in the list for all rows.
  • CIt requires that all expressions in the list must be of the same data type.
  • DIt requires that at least one of the expressions in the list must have a NOT NULL value.

How the community answered

(23 responses)
  • A
    9% (2)
  • B
    13% (3)
  • C
    74% (17)
  • D
    4% (1)

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.

Topics

#COALESCE#NULL handling#conditional expressions#data type compatibility

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice