select * from tablea where nvl(field2,'NULL') != 'aa'

解决方案 »

  1.   

    oracle的三值逻辑:
    null!=null
    null!='aa'
      

  2.   

    select * from tablea where field2 != 'aa' or field2 is null
      

  3.   

    回复人: black_snail(●龙飞虎○) ( )  
     
      select * from tablea where nvl(field2,'NULL') != 'aa'
     
    回复人: w_tsinghua() ( )  
     
      select * from tablea where field2 != 'aa' or field2 is null
      两种方法都应该可以。试试
      

  4.   

    我也知道这两种方发可以,但是我就是不明白为什么
    null不是不等于'aa'吗?为什么这样的纪录就不被选取呢
      

  5.   

    null是一个特殊的值,这个问题有点难解释,就好像NULL和0的区别一样,NULL应该是不支持“=”符号的,我就是这么理解的。
      

  6.   

    没有原因,这是规定!
    null是不知道是什么东东,所以不知道等于还是不等于'aa'
      

  7.   

    我上面说错了。
    null='aa'  ---不能确定
    null!='aa' ---不能确定
    null是不确定的。
    ------------------------
    |                      |
    |   相逢何必曾相识     |
    |                      |
    ------------------------
      

  8.   

    select * from tablea 
    minus
    select * from tablea where field2 ='aa';
      

  9.   

    NULL='aa' is false
    NULL<>'aa' also false