Oracle 10g中如何评估在布尔前pressions NULL [英] How Oracle 10g evaluates NULL in boolean expressions
问题描述
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:
- 空值:没什么好担心的
- PL / SQL 的基础。向下滚动到 -
处理Null值在比较和条件语句
- 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屋!