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: SQL SELECT with date restriction, please help !

Re: SQL SELECT with date restriction, please help !

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 31 Aug 2001 11:43:01 +0200
Message-ID: <toun9apdpafr1c@news.demon.nl>

"Nicolas Ungern-Sternberg" <nungern_at_sbe-online.com> wrote in message news:9mnj8k$e7q$1_at_s1.read.news.oleane.net...
> hello every body,
>
> Sorry but my english is bad...
>
> 1 ) FIRST SELECT :
>
> select count(*) from sbedba.fiches
> where dateent=to_date('30/08/2001')
>
> COUNT(*)
> ---------
> 72
>
> Plan d'exécution
> ----------------------------------------------------------
> 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=7)
> 1 0 SORT (AGGREGATE)
> 2 1 INDEX (RANGE SCAN) OF 'IDX_FICHES_DATEENT' (NON-UNIQUE)
> (Cost=1 Card=264 Bytes=1848)
>
>
> 2 ) SECOND SELECT
>
> select count(*) from sbedba.fiches
> where to_char(dateent,'DD/MM/YYYY')=to_date('30/08/2001')
>
> COUNT(*)
> ---------
> 1004
>
> Plan d'exécution
> ----------------------------------------------------------
> 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2395 Card=1 Bytes=7)
> 1 0 SORT (AGGREGATE)
> 2 1 TABLE ACCESS (FULL) OF 'FICHES' (Cost=2395 Card=2457
> Bytes=17199)
>
>
> I'm understand that the problem is the TIME in my DATEENT column ; But
what
> is the solution ???
>
> Thank you for advance,
>
> Nicolas.
>
> --
> Nicolas Ungern-sternberg
> Service informatique - 376
> nungern_at_sbe-online.com
> 03.21.10.08.35
>
>

date_ent between to_date('30/08/2001')

              and to_date('30/08/2001')+ 1 /*day*/ - (1/24*60*60) /*one second */

Hth,

Sybrand Bakker, Senior Oracle DBA Received on Fri Aug 31 2001 - 04:43:01 CDT

Original text of this message

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