0

this select on Oracle 11 work ok

select 
*
FROM
ALL_CONSTRAINTS C
WHERE C.CONSTRAINT_TYPE='P'
AND COALESCE(C.INDEX_NAME, ' ')<>' ' /* space */

but this return no rows

select 
*
FROM
ALL_CONSTRAINTS C
WHERE C.CONSTRAINT_TYPE='P'
AND COALESCE(C.INDEX_NAME, '')<>'' /* empty string */

as you can see difference is only between

COALESCE(C.INDEX_NAME, '')<>'' and COALESCE(C.INDEX_NAME, ' ')<>' '

I do not understand why this happened - a bug? Or i missed something

Livius
  • 958
  • 1
  • 6
  • 19
  • 3
    Because Oracle considers the empty string to be NULL and NULL is never equal to or unequal to any other value including NULL. – Justin Cave Sep 25 '15 at 11:00
  • Thanks you, i am new in Oracle. And yes this post is duplicate of that link. I do not find it, but my assumption was wrong and i search for different words – Livius Sep 25 '15 at 11:19

0 Answers0