Oracle 10g中如何评估在布尔前pressions NULL [英] How Oracle 10g evaluates NULL in boolean expressions

查看:125
本文介绍了Oracle 10g中如何评估在布尔前pressions NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if not (i_ReLaunch = 1 and (dt_enddate is not null))

如何这封pression将在Oracle 10g中进行评估
当输入值 i_ReLaunch = NULL 和的值 dt_enddate 不为空
它是在进入循环。
根据普通的C#的规则,所有它不应该进入环路
这将是与值如下。

How this epression will be evaluated in Oracle 10g when the input value of the i_ReLaunch = null and the value of the dt_enddate is not null it is entering the loop. According to the rules in normal c# and all it should not enter the loop as it will be as follows with the values.

如果(否(false和(真))
 =如果不是(假)
= IF(真)
这意味着它应该进入循环

If( not(false and (true)) = if not( false) =if( true) which implies it should enters the loop

但它没有发生。

有人可以让我知道,如果我在任何地方我错了

Can someone let me know if i am wrong at any place

推荐答案

在甲骨文回报未知 NULL值的布尔运算 - 不是真或假。所以,你有这样的事情:

Boolean operations with NULL value in Oracle return UNKNOWN - not true or false. So you have something like this:

If( not(UNKNOWN and (true)) = if not( UNKNOWN) =if( UNKNOWN )

在这种情况下,如果将把UNKNOWN为假。

In this case, IF will treat UNKNOWN as false.

如果 i_relaunch 可以为空,那么你需要使用一些NULL处理功能( NVL,NVL2,NULLIF,COALESCE,LNNVL ),以确保您有正确的结果。

If i_relaunch can be null, then you need to use some of NULL handling functions(NVL, NVL2, NULLIF, COALESCE, LNNVL) to be sure that you have correct result.

有关详细信息,请参阅以下文章:

See these article for more information:

  • Nulls: Nothing to Worry About
  • Fundamentals of PL/SQL. Scroll down to - Handling Null Values in Comparisons and Conditional Statements

这篇关于Oracle 10g中如何评估在布尔前pressions NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆