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

Home -> Community -> Usenet -> c.d.o.server -> Re: The use of COUNT(*)

Re: The use of COUNT(*)

From: Chuck Bayes <chuck.bayes_at_compaq.com>
Date: Fri, 10 Jul 1998 19:50:30 GMT
Message-ID: <01bdac3b$f857e640$6b421cac@cbayes.wins.compaq.com>


Lai,

    You could also put a "rownum < 2" clause in your where statement to force it to stop at 1.

Hope this helps,

Chuck
#include <std_disclaimer.h>

Lai King Leung <LaiKing_at_syslogic.com> wrote in article <01bdabde$e3f537f0$92cc0bc3_at_carrera_09>...
> Could anyone tell me about the use of COUNT(*)? I currently use the
> comamnd
>
> SELECT COUNT(*) INTO v_count FROM tbl_data WHERE ... in my PL/SQL program
> unit, to determine whether there are any records to be processed.
>
> In some cases I use the command
> SELECT COUNT(*) INTO v_count FROM tbl_tmpdata to determine if there is
any
> data in the table.
>
> I've been told that it is very inefficient to use COUNT(*) and that I
> should declare a CURSOR and look at the %FOUND attribute instead ??
>
> I would appreciate any suggestions on the use of COUNT(*) especially when
> it should be used, and when it should be avoided at all cost.
>
> Thank-you in adavnce
> Regards
> Lai King
>
Received on Fri Jul 10 1998 - 14:50:30 CDT

Original text of this message

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