Oracle Database SQL — Question 79
The CUSTOMERS table has a CUST_CREDIT_LIMIT column of data type number.
Which two queries execute successfully? (Choose two.)
Answer options
- A. SELECT NVL2(cust_credit_limit * .15, 'Not Available') FROM customers;
- B. SELECT NVL2(cust_credit_limit, TO_CHAR(cust_credit_limit * .15), 'Not Available') FROM customers
- C. SELECT NVL(cust_credit_limit * .15, 'Not Available') FROM customers;
- D. SELECT NVL(TO_CHAR(cust_credit_limit * .15), 'Not Available') FROM customers;
- E. SELECT TO_CHAR(NVL(cust_credit_iimit * .15, 'Not Available')) FROM customers;
Correct answer: B, D
Explanation
The correct answers are B and D. Option B uses NVL2 correctly to check if cust_credit_limit is not null, converting the calculation to a string format, which is valid. Option D also correctly applies NVL to the result of TO_CHAR. Options A and C do not handle potential null values properly in the context of the number type, and option E contains a typo in 'cust_credit_iimit'.