The CUSTOMERS table has a CUST_CREDIT_LIMIT column of data type number.
Which two queries execute successfully? (Choose two.)
The CUSTOMERS table has a CUST_CREDIT_LIMIT column of data type number.
Which two queries execute successfully? (Choose two.)
In the CUSTOMERS table, the CUST_CREDIT_LIMIT column is of type number. The SELECT statement must handle this data type appropriately. NVL2 function requires three arguments and allows for different data types in arguments. The NVL function, on the other hand, requires that the two arguments have compatible data types or can be implicitly converted. Option B uses NVL2 and correctly applies TO_CHAR to convert the number before using a string as the third argument. Option D uses NVL correctly by converting the number to a string with TO_CHAR, making 'Not Available' a valid alternative.
BD tested
A: ORA-00909: invalid number of arguments C: ORA-01722: invalid number E: ORA-01722: invalid number
NVL2 requires 3 arguments and it doesnt have to be the same data type NVL requires 2 arguments and it must be the same datatype or something that is implicitly converted
NVL2(STH,1,'X') - doesn't work, needs same or converted data type, but reverse order of parameters works. You can't use NUMBER before VARCHAR in NVL2.
NVL2(STH,1,'X') does not work because 'X' cant be converted to a number, if it was '1' like NVL2(STH,1,'1') it works.
BD correct -> Data type has to be the same for NVL but not for NVL2