OCP-1Z0-051-V9.02-106题

106. Examine the data in the LIST_PRICE and MIN_PRICE columns of the PRODUCTS table:

LIST_PRICE     MIN_PRICE

10000          8000

20000

30000          30000

Which two expressions give the same output? (Choose two.)

A. NVL(NULLIF(list_price, min_price), 0) 

B. NVL(COALESCE(list_price, min_price), 0)  如果list_price为空,则返回min_price,如果min_price为空,则返回空值,如果是空值,则返回0

C. NVL2(COALESCE(list_price, min_price), min_price, 0)

D. COALESCE(NVL2(list_price, list_price, min_price), 0) 如果list_price为空,则返回min_price,如果min_price为空,则返回0,否则返回list_price,

Answer: BD
 
答案解析:
LIST_PRICE 从表中看,没有空值,故
B的结果为list_price,D的结果为list_price
C的结果为min_price
A分情况,不等时为list_price,相等时为0
 
1.NVL参考: http://blog.csdn.net/rlhua/article/details/11805803
2.NVL2参考: http://blog.csdn.net/rlhua/article/details/11808291
3.NULLIF参考: http://blog.csdn.net/rlhua/article/details/11810737
4.COALESCE参考: http://blog.csdn.net/rlhua/article/details/11919341
 

你可能感兴趣的:(OCP-1Z0-051-V9.02-106题)