Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 24 Sep 2012 @ 20:06:21 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: In where condition 'not' and 'and is not working together
 
From:   Pluebell, Fred

Your issue is 3-value logic, i.e. how NULL is handled. In particular, comparing NULL with another value (even another NULL) yields NULL as the result. To test for NULL you must use IS NULL (or IS NOT NULL). In the example:

not(100=100 and '1'='1') -> not (True and True) -> not (True) -> False

not(NULL=100 and '1'='1') -> not(NULL and True) -> not(NULL) -> NULL; but since this is final result, treated as False

not(NULL=100 and NULL='1') -> not(NULL and NULL) -> not(NULL) -> NULL; treated as False

not(NULL=NULL and '2'='1') -> not(NULL and False) -> not(False) -> True



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016