OCP-1Z0-051-V9.02-98题
2013-09-23 09:28
295 查看
98. Which statement is true regarding the COALESCE function?
A. It can have a maximum of five expressions in a list. 最多只能有5个表达式,错,无限个
B. It returns the highest NOT NULL value in the list for all rows. 返回最高的非空值,错,返回第一个非空值
C. It requires that all expressions in the list must be of the same data type. 所有都要相同的类型
D. It requires that at least one of the expressions in the list must have a NOT NULL value. 至少有一个不是空值,错,可以都是空值,则返回空值
Answer: C
答案解析:
Purpose
COALESCE (expression_1, expression_2, ...,expression_n)
列表中第一个非空的表达式是函数的返回值,如果所有的表达式都是空值,最终将返回一个空值。
Oracle Database uses short-circuit evaluation. The database evaluates each
If all occurrences of
precedence, implicitly converts the remaining arguments to that data type, and returns that data type.
This function is a generalization of the
You can also use
COALESCE(expr1, expr2)
is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END
Similarly,
COALESCE(expr1, expr2, ..., exprn)
where
CASE WHEN expr1 IS NOT NULL THEN expr1
ELSE COALESCE (expr2, ..., exprn) END
官方参考:http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions030.htm#sthref995
A. It can have a maximum of five expressions in a list. 最多只能有5个表达式,错,无限个
B. It returns the highest NOT NULL value in the list for all rows. 返回最高的非空值,错,返回第一个非空值
C. It requires that all expressions in the list must be of the same data type. 所有都要相同的类型
D. It requires that at least one of the expressions in the list must have a NOT NULL value. 至少有一个不是空值,错,可以都是空值,则返回空值
Answer: C
答案解析:
Purpose
COALESCE (expression_1, expression_2, ...,expression_n)
列表中第一个非空的表达式是函数的返回值,如果所有的表达式都是空值,最终将返回一个空值。
COALESCEreturns the first non-null
exprin the expression list. You must specify at least two expressions. If all occurrences of
exprevaluate to null, then the function returns null.
Oracle Database uses short-circuit evaluation. The database evaluates each
exprvalue and determines whether it is
NULL, rather than evaluating all of the
exprvalues before determining whether any of them is
NULL.
If all occurrences of
exprare numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type, then Oracle Database determines the argument with the highest numeric
precedence, implicitly converts the remaining arguments to that data type, and returns that data type.
This function is a generalization of the
NVLfunction.
You can also use
COALESCEas a variety of the
CASEexpression. For example,
COALESCE(expr1, expr2)
is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END
Similarly,
COALESCE(expr1, expr2, ..., exprn)
where
n>= 3, is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1
ELSE COALESCE (expr2, ..., exprn) END
官方参考:http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions030.htm#sthref995
相关文章推荐
- OCP-1Z0-051-V9.02-118题
- OCP-1Z0-051-V9.02-144题
- OCP-1Z0-051-V9.02-113题
- OCP-1Z0-051-V9.02-154题
- OCP-1Z0-051-V9.02-43题
- OCP-1Z0-051-V9.02-69题
- OCP-1Z0-051-V9.02-105题
- OCP-1Z0-051-V9.02-133题
- OCP-1Z0-051-V9.02-161题
- OCP-1Z0-051-V9.02-3题
- OCP-1Z0-051-V9.02-23题
- OCP-1Z0-051-V9.02-13题
- OCP-1Z0-051-V9.02-120题
- OCP-1Z0-051-V9.02-32题
- OCP-1Z0-051-V9.02-145题
- OCP-1Z0-051-V9.02-106题
- OCP-1Z0-051-V9.02-114题
- OCP-1Z0-051-V9.02-155题
- OCP-1Z0-051-V9.02-44题
- OCP-1Z0-051-V9.02-37题