QUESTION NO: 53
A. Both the statements execute and give the same result
B. Both the statements execute and give different results
C. Only the second SQL statement executes successfully
D. Only the first SQL statement executes successfully
Answer: B
Explanation:
Using the NVL2 Function
The NVL2 function examines the first expression. If the first expression is not null, the NVL2
function returns the second expression. If the first expression is null, the third expression is returned.
Syntax
NVL2(expr1, expr2, expr3)
In the syntax:
expr1 is the source value or expression that may contain a null
expr2 is the value that is returned if expr1 is not null
expr3 is the value that is returned if expr1 is null
The PRODUCTS table has the following structure:
nvl如果 不为空即是自己,nvl2如果prod_expiry_date 不为空即是prod_expiry_date +15
nvl如果prod_expiry_date 为空即是prod_expiry_date+15,nvl2如果prod_expiry_date 为空即是‘ ’
Which statement is true regarding the outcome?A. Both the statements execute and give the same result
B. Both the statements execute and give different results
C. Only the second SQL statement executes successfully
D. Only the first SQL statement executes successfully
Answer: B
Explanation:
Using the NVL2 Function
The NVL2 function examines the first expression. If the first expression is not null, the NVL2
function returns the second expression. If the first expression is null, the third expression is returned.
Syntax
NVL2(expr1, expr2, expr3)
In the syntax:
expr1 is the source value or expression that may contain a null
expr2 is the value that is returned if expr1 is not null
expr3 is the value that is returned if expr1 is null
本文详细介绍了SQL中NVL和NVL2函数的使用方式及区别,通过实例展示了如何根据条件返回不同结果。
4966

被折叠的 条评论
为什么被折叠?



