Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Weird Query
Marian Aldenhövel schrieb:
> Hi,
>
>> Well, it's simply an agreement, i could say that en empty string >> doesn't compare with any "real" value too, but it's not the point, the >> point is , that you should write your sql *according* the rules which >> are adopted in the rdbms engine.
>> it is very irrational to expect that Oracle behave equally those
>> do you expect the very *same* row to be returned for both where >> clauses - WHERE PP_LOCK IS NULL and WHERE PP_LOCK IS NOT NULL?
and the intersection of A and B to be
> empty. The results of "equal" and "does not equal" should be distinct.
Only if you compare properly, in case of empty string means:
WHERE column IS NULL
and
WHERE column IS NOT NULL
What you are doing, is ( very simplified of course ) comparable with:
(4-4)=(5-5) => 4(1-1)=5(1-1) => 4=5 => 2*2 = 5
>
> I further expect "WHERE PP_LOCK IS NULL" to return another set C and
> I do not care whether C is included in A or not. The _Union_ of A, B
> and C should however in my very limited understanding of relational
> logic consist of _every_ record in the table.
>
> If it's NULL it's in C. If it's not NULL it either has some text or
> an empty string.
The very same again - if it's empty string, then it is in C. The empty
string is NULL.
So it's in A or B.
>
> This is not the case here, though. My test record is in none of A, B or
> C. And very clearly it does _not_ have NULL in PP_LOCK, I count 47
> characters of text.
>
> Ciao, MM
Your test record contains 47 characters, also it is definitely NOT NULL, to query this record you should
select pp_lock from cbr_385120060b39d42d8 where pp_lock IS NOT NULL;
( not the WHERE pp_lock <> NULL ,
not the WHERE pp_lock <>'',
please remember, every comparison with NULL ( the '' is another form to
express NULL ) results in NULL. The only proper method to check the
value for NULLness is: "IS NULL" or "IS NOT NULL" , both results in TRUE
or FALSE resp.)
Best regards
Maxim Received on Mon Aug 01 2005 - 08:19:44 CDT
![]() |
![]() |