ITPub博客

首页 > 数据库 > Oracle > ORACLE 数据库函数-NULLIF

ORACLE 数据库函数-NULLIF

翻译 Oracle 作者:zy_rain 时间:2018-05-24 16:17:06 0 删除 编辑

NULLIF:ORACLE  null相关的函数


语法NULLIF( expr1 , expr2)


Purpose

NULLIF compares  expr1 and  expr2. If they are equal, then the function returns null. If they are not equal, then the function returns  expr1. You cannot specify the literal  NULL for  expr1.

If both arguments are numeric data types, then Oracle Database determines the argument with the higher numeric precedence, implicitly converts the other argument to that data type, and returns that data type. If the arguments are not numeric, then they must be of the same data type, or Oracle returns an error.

The  NULLIF function is logically equivalent to the following  CASE expression:

CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END


用途


NULLIF比较expr1和expr2。

如果两个参数相等,则返回NULL,如果两个表达式不相等,NULLIF 返回第一个 expr1 的值。

如果两个参数都是数值数据类型,则Oracle数据库将确定具有较高数值优先级的参数,隐式地将另一个参数转换为该数据类型,并返回该数据类型。如果参数不是数字,则它们必须是相同的数据类型,否则Oracle将返回错误。

等价语句:CASE WHEN expr1= expr2  THEN null ELSE  expr1 END

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30349701/viewspace-2155050/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论
没有刻骨铭心的记忆,怎么会有潇洒自如的帅气!

注册时间:2015-07-15

  • 博文量
    16
  • 访问量
    17898