Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: where clause
NULL is NULL. It is not equal anything and it is not unequal anything. It
is just NULL
To look for presence of absence of NULL you have to use the syntax especially provided for that "IS NULL" or "IS NOT NULL"
At 12:55 PM 2/6/2004, you wrote:
>Hi List,
>
>I found following results that I don't understand.
>
>SQL> desc test
>Name Null? Type
>----------------------------------------- -------- -----------------
>STATUS_FLAG CHAR(1)
>
>SQL> SELECT COUNT(*) FROM test;
>
> COUNT(*)
>----------
> 1681
>
>SQL> SELECT COUNT(*) FROM test WHERE status_flag IS NULL;
>
> COUNT(*)
>----------
> 1638
>
>SQL> SELECT COUNT(*) FROM test WHERE status_flag ='A';
>
> COUNT(*)
>----------
> 5
>
>SQL> SELECT COUNT(*) FROM test WHERE status_flag ='S';
>
> COUNT(*)
>----------
> 38
>
>SQL> SELECT COUNT(*) FROM test WHERE status_flag !='A';
>
> COUNT(*)
>----------
> 38
>
>I thought the last query should return 1676 (status_flag ='S' + status_flag
>is null) instead of 38 (status_flag ='S' only). Any ideas???
>
>_________________________________________________________________
>Let the advanced features & services of MSN Internet Software maximize your
>online time. http://click.atdmt.com/AVE/go/onm00200363ave/direct/01/
>
>----------------------------------------------------------------
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>----------------------------------------------------------------
>To unsubscribe send email to: oracle-l-request_at_freelists.org
>put 'unsubscribe' in the subject line.
>--
>Archives are at http://www.freelists.org/archives/oracle-l/
>FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
>-----------------------------------------------------------------
Wolfgang Breitling
Oracle7, 8, 8i, 9i OCP DBA
Centrex Consulting Corporation
http://www.centrexcc.com
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Fri Feb 06 2004 - 14:07:41 CST
![]() |
![]() |