QuestionQ62

VerifiedUsing Conversion Functions and Conditional Expressions

Examine the definition of the EMPLOYEES table:

Question Image

Which three queries return all rows for which SALARY + COMMISSION is greater than 20000?

Choose three
Explanation

SALARY is non-null, while COMMISSION can be null. Oracle arithmetic with a null operand returns null, so rows with a missing commission must evaluate that commission as zero, or explicitly fall back to SALARY. NVL2(salary + commission, salary + commission, salary) returns the sum when it is non-null and returns SALARY otherwise. Both salary + NVL2(commission, commission, 0) and salary + NVL(commission, 0) replace a null commission with zero. The choices use >= 20000; interpreted literally, that includes rows equal to 20000, while the stem states a strict greater-than comparison.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!