• 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
     
     
  • 相关阅读:
    关于http头
    关于js中的命名
    PHP之APC缓存详细介绍
    找回Windows Vista桌面的IE7.0图标
    查看操作系统是不是中文正式版?
    如何判断XP是否已激活
    Vista取消默认共享
    今天是儿童节,祝福儿子节日快乐!
    天天锻炼身体好!
    如何查看你的XP SP2是否原版?
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317195.html
Copyright © 2020-2023  润新知