Re: alternative to select count(*) : do i need to ?
Date: Sun, 19 Dec 1999 16:05:24 +0100
Message-ID: <gt674.8348$68.51588_at_afrodite.telenet-ops.be>
Count works quick if no records are found, but what if you have for instance
1 milion records?
Try to limit your fetch with the following statement, it will only fetch 1
row:
Select count(*) from mytable where criteria and rownum < 2
Or even better, open a cursor , fetch the first record and close the cursor.
<legarema_at_uqtr.uquebec.ca> schreef in berichtnieuws
385A5E94.9472D42C_at_uqtr.uquebec.ca...
> Hi all,
>
> I am mostly programming in Pro*C 8.0.5.0.0 with an
> oracle 8.0.5 database (on aix 4.2.1.0). I have read
> some posts on this forum and on some web pages that
> are saying that it's bad programming to do a :
>
> select count(*) from mytable where criteria
>
> Most of the time I use count(*) to know if there is
> zero, one or more than one record matching my criteria.
>
> Is it really "bad programming" ?
> If yes, is why ?
> What are the alternatives ?
>
> Thanks a lot,
Received on Sun Dec 19 1999 - 16:05:24 CET