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: Lothar Armbruester <lothar.armbruester_at_t-online.de>
Date: Tue, 4 Sep 2001 18:46:55 +0200
Message-ID: <PM00038D26A31D5B91@hades.none.local>


Nicolas Ungern-Sternberg wrote:
> Thanks you every body for your responses !
>
> between to_date('30/08/2001 00:00:00','DD/MM/YYYY HH24:MI:SS') and
> to_date('30/08/2001 23:59:59','DD/MM/YYYY HH24:MI:SS')
>
> It's more easy ? no ?
>

Well, you could use

select * from your_table
where trunc(your_column) = to_date('30/08/2001','DD/MM/YYYY');

But this will not use an index on your_column. Unless there is a function based index on trunc(your_column). (I don't know if that's possible though.)

Another way would be:

select * from your_table
where your_column >= to_date('30/08/2001','DD/MM/YYYY') and

      your_column < to_date('31/08/2001','DD/MM/YYYY');

Hope that helps,
Lothar

-- 
Lothar Armbrüster       | la_at_oktagramm.de
Hauptstr. 26            | la_at_heptagramm.de
D-65346 Eltville        | lothar.armbruester_at_t-online.de
Received on Tue Sep 04 2001 - 11:46:55 CDT

Original text of this message

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