Oracle Database SQL — Question 39
Which two are true about the NVL, NVL2, and COALESCE functions? (Choose two.)
Answer options
- A. NVL must have expressions of the same data type.
- B. NVL can have any number of expressions in the list.
- C. NVL2 can have any number of expressions in the list.
- D. COALESCE stops evaluating the list of expressions when it finds the first non-null value.
- E. The first expression in NVL2 is never returned.
- F. COALESCE stops evaluating the list of expressions when it finds the first null value.
Correct answer: D, E
Explanation
The correct answer is D because COALESCE evaluates the list until it finds the first non-null value, which is its purpose. E is also correct because NVL2's first expression is meant to determine the output based on the nullity of the second expression, and thus it is not returned. The other options are incorrect because NVL requires same data types (A), NVL does not accept multiple expressions (B), NVL2 does not allow for multiple expressions (C), and COALESCE does not stop at null values (F).