View the Exhibit and evaluate the structure and data in the CUST_STATUS table.
You issue the following SQL statement:8
Which statement is true regarding the execution of the above query?
A.
It produces an error because the AMT_SPENT column contains a null value.
B.
It displays a bonus of 1000 for all customers whose AMT_SPENT is less than
CREDIT_LIMIT.
C.
It displays a bonus of 1000 for all customers whose AMT_SPENT equals CREDIT_LIMIT,
or AMT_SPENT is null.
D.
It produces an error because the TO_NUMBER function must be used to convert the
result of the NULLIF function before it can be used by the NVL2 function.
Explanation:
The NULLIF Function
The NULLIF function tests two terms for equality. If they are equal the function returns a null,
else it returns the first of the two terms tested.
The NULLIF function takes two mandatory parameters of any data type. The syntax is
NULLIF(ifunequal, comparison_term), where the parameters ifunequal and comparison_termare compared. If they are identical, then NULL is returned. If they differ, the ifunequal
parameter is returned.
C is correct answer
Step 1: NULLIF(amt_spent, credit_limit) retuns
null
2000
null
3000
In Step 2: NVL2(null,0,1000)”Bonus”
Returns 1000
1000
null
1000
null