Re: count(*) with NULLs involved

From: N Prabhakar <prabhs_at_po.pacific.net.sg>
Date: 1996/11/02
Message-ID: <55f47o$p4c_at_newton.pacific.net.sg>#1/1


When you use NOT opeator, Oracle will ignore NULL values in a column.

Your query is

 select count(*) from test_table
 where column_X not in ('B','C');

Change the query to read as

 select count(*) from test_table
 where nvl(column_X,' ') not in ('B','C');

This will forcibly convert all the NULLS to ' ' during the query.There is no need to change the values in that column,

Since NULL is something undefined, Oracle will always leave NULL columns in the NOT operation.

Regards

N.Prabhakar
Socgen Crosby Securities
Singapore

Tel : 65 390 2228 (office)

      65 560 7785 (residence) Received on Sat Nov 02 1996 - 00:00:00 CET

Original text of this message