3

i found this site: here

its very well described why it works and why not.

but my question is a little different.

select 'true' from dual where 'test' not in ('test2','');

why does this query not returing a row?
is '' handled like null?

thx for your help

Community
  • 1
  • 1
domiSchenk
  • 880
  • 4
  • 23
  • 41
  • 2
    I'm not sure (I'm a SQL Server person) but I think Oracle does handle '' as null. – HLGEM Aug 23 '10 at 15:15
  • possible duplicate of [Why does Oracle 9i treat an empty string as NULL?](http://stackoverflow.com/questions/203493/why-does-oracle-9i-treat-an-empty-string-as-null) – APC Aug 23 '10 at 16:21
  • 1
    @APC - Not really. This question is `does it...?` not `why does it...?` – Martin Smith Aug 23 '10 at 16:23
  • 1
    @MartinSmith - well I think the answers to that question also answer this question. So to that extent it is a duplicate. – APC Aug 23 '10 at 16:48

2 Answers2

12

Your suspicions were correct.

So your query is basically

WHERE 'test' <> 'test2' and  'test' <> Null

Which evaluates as

WHERE true and unknown

Which is unknown

select * from dual where '' = '';

will give the same (lack of) results

Martin Smith
  • 438,706
  • 87
  • 741
  • 845
2

Yes, in Oracle an empty string is a NULL.