Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Weird "select count(*)..."

Re: Weird "select count(*)..."

From: $ Robert $ <drsql_at_tir.com>
Date: 1997/06/18
Message-ID: <33A86CD7.3F5F@tir.com>#1/1

Since the column pcg_numlig can be null you must change youe sql if you want nulls to be be included
in the counting.

Therefore,

change

SQL> select count(*) from plan_comptable   2 where pcg_numcptgen = pcg_numcptgen

  3  and pcg_libcptgen = pcg_libcptgen
  4  and pcg_typsolde = pcg_typsolde
  5  and pcg_duramort = pcg_duramort
  6  and pcg_detail = pcg_detail
  7  and pcg_numlig = pcg_numlig;

to

SQL> select count(*) from plan_comptable   2 where pcg_numcptgen = pcg_numcptgen

  3  and pcg_libcptgen = pcg_libcptgen
  4  and pcg_typsolde = pcg_typsolde
  5  and pcg_duramort = pcg_duramort
  6  and pcg_detail = pcg_detail

  7 and nvl(pcg_numlig,-1) = nvl(pcg_numlig,-1);

and your count will come out right.

Take care,
Bob Received on Wed Jun 18 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US