Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL SELECT with date restriction, please help !
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.deReceived on Tue Sep 04 2001 - 11:46:55 CDT