Unequal Equality??? Anyone know why NULL ñ is equal to NULL.

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 11 Oct 2007 2:41 pm

aí ... I had a doubt here ... maybe it's a bullshit my ... lol but for example ...

The instruction \"SELECT ' test ' TST FROM DUAL WHERE NULL = NULL\" returns nothing ... example:
Code: Select all
SQL> SELECT 'TESTE' TST FROM DUAL WHERE NULL = NULL;

TST
-----

SQL> SELECT 'TESTE' TST FROM DUAL WHERE 0 = 0;

TST
-----
TESTE
does anyone have an explanation for that????
Renan Orati
Location: São José do Rio Preto - SP

Poston Thu, 11 Oct 2007 4:53 pm

Must use IS NULL rather than = NULL Example:
Code: Select all
SQL> SELECT 'TESTE' TST FROM DUAL WHERE NULL is NULL;

TST
-----
TESTE

SQL>
Here this link has some more considerations for comparison with NULL: http://glufke.net/2007/09/06/comparacao ... .php?p=343
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


  • See also
    Replies
    Views
    Last Post


      Return to SQL

      Who is online

      Users browsing this forum: No registered users and 4 guests