-1

I'm puzzled by this in Oracle

select case when 'hello' <> '' then 1 else 2 end from dual;

returns 2

select case when 'hello' <> 'hello' then 1 else 2 end from dual;

returns 2

however on SQL*Server this works as expected.

Luc M
  • 16,630
  • 26
  • 74
  • 89

1 Answers1

6

Empty string in Oracle acts as null - so your comparison <> null will be always false...
(edit proposed by igr)

Community
  • 1
  • 1
Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64