zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-98题

    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)

    列表中第一个非空的表达式是函数的返回值,如果所有的表达式都是空值,最终将返回一个空值。

    COALESCE returns the first non-null expr in the expression list. You must specify at least two expressions. If all occurrences of expr evaluate to null, then the function returns null.

    Oracle Database uses short-circuit evaluation. The database evaluates each expr value and determines whether it is NULL, rather than evaluating all of the expr values before determining whether any of them is NULL.

    If all occurrences of expr are 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 NVL function.

    You can also use COALESCE as a variety of the CASE expression. 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
     
     
  • 相关阅读:
    蓝桥杯入门训练
    <泛> STL
    传递 hdu 5961 拓扑排序有无环~
    Alice and Bob hdu 4268
    Bipartite Graph hdu 5313 bitset 并查集 二分图
    Bomb HDU 3555 dp状态转移
    不要62 hdu 2089 dfs记忆化搜索
    Leaving Auction CF 749D
    Moo University
    算法(三)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317195.html
Copyright © 2011-2022 走看看