16、choose the best answer
The PRODUCTS table has the following structure:
Evaluate the following two SQL statements:
SQL>SELECT prod_id, NVL2(prod_expiry_date, prod_expiry_date + 15,'')
FROM products;
SQL>SELECT prod_id, NVL(prod_expiry_date, prod_expiry_date + 15)
FROM products;
Which statement is true regarding the outcome?
A) Both the statements execute and give different results.
B) Both the statements execute and give the same result.
C) Only the second SQL statement executes successfully.
D) Only the first SQL statement executes successfully.
Answer:C
解析:
NVL( string1, replace_with) 功能:如果string1为NULL,则NVL函数返回replace_with的值,否则返回string1的值
NVL2(E1, E2, E3)的功能为:如果E1为NULL,则函数返回E3,若E1不为null,则返回E2