Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: where clause
I've found that telling myself that null fails all tests (except is null)
works.
Simon Fox
CRH 0161 601 8723
-----Original Message-----
From: David Boyd [mailto:davidb158_at_hotmail.com]
Sent: 06 February 2004 19:55
To: oracle-l_at_freelists.org
Subject: where clause
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???
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
![]() |
![]() |