Oracle Database Administration I — Question 52
The CUSTOMERS table has a CUST_CREDIT_LIMIT column of data type NUMBER.
Which two queries execute successfully? (Choose two.)
Answer options
- A. SELECT NVL(cust_credit_limit * .15, 'Not Available') FROM customers;
- B. SELECT NVL2(cust_credit_limit * .15, 'Not Available') FROM customers;
- C. SELECT NVL(TO_CHAR(cust_credit_limit * .15), 'Not Available') FROM customers;
- D. SELECT TO_CHAR(NVL(cust_credit_limit * .15, 'Not Available')) FROM customers;
- E. SELECT NVL2(cust_credit_limit, TO_CHAR(cust_credit_limit * .15), 'Not Available') FROM customers;
Correct answer: C, E
Explanation
Option C is correct because it uses NVL correctly, converting the numeric result to a string using TO_CHAR before applying NVL. Option E is also correct as it uses NVL2, which checks if cust_credit_limit is not null, and converts the numeric result to a string with TO_CHAR. Options A, B, and D will fail because they either do not handle null values appropriately or do not convert the data type correctly.