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: Getting Record Count from SELECTs

Re: Getting Record Count from SELECTs

From: Maxim Demenko <mdemenko_at_arcor.de>
Date: Tue, 11 Oct 2005 19:13:00 +0200
Message-ID: <434bf2b7$0$10228$9b4e6d93@newsread2.arcor-online.net>


GeoPappas schrieb:
> Is there any way to get the record count from a SELECT statement
> without having to run another query?
>
> For example, say you have a query as follows:
>
> SELECT * FROM temp WHERE create_date < TO_DATE( '01/01/2005',
> 'MM/DD/RRRR' );
>
> Is there any way to get the record count without having to run anothe
> SELECT, such as:
>
> SELECT COUNT(*) FROM temp WHERE create_date < TO_DATE( '01/01/2005',
> 'MM/DD/RRRR' );
>

Yet another possibility using analytics ( slightly increased cost compared to original query )

SELECT
count(*) over() cnt,
t.* FROM temp t WHERE create_date < TO_DATE( '01/01/2005','MM/DD/RRRR' );

Best regards

Maxim Received on Tue Oct 11 2005 - 12:13:00 CDT

Original text of this message

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