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: sysdate & date columns

Re: sysdate & date columns

From: Emmanuel HUMBLOT <e_humblot_at_wanadoo.fr>
Date: 20 Jan 2000 09:58:40 GMT
Message-ID: <01bf6335$b8898520$3601017e@EHM.cirra.fr>


If you are sure you date1 has hour:minute:second set to 00:00:00

        select * from table1 where date1=trunc(sysdate); will always be the best.

If date1 has not hour:minute:second set to 00:00:00

        If date1 is not indexed, this will work fine :

                select * from table1 where trunc(date1)=trunc(sysdate);

        If date1 is indexed, using the trunc function will cause the index not to work, so :

                select * from table1 where date1 >= trunc(sysdate) and date1 < trunc(sysdate)+1;   

                        is preferable if your table statistics are up to
date (analyze table table1 estimate statistics) and your optimizer mode is statistics.

Larry Pettit <larry.pettit_at_ps.net> a écrit dans l'article <YTrh4.134$j4.7687_at_news.uswest.net>...
>
> This doesn't work.
>
> select * from table1 where date1 = sysdate
> Is there a way to compare a date column with sysdate other than
> converting both using to_char()?
>
> I think the time part of the date is causing this not to work, any
> suggestions?
>
> Thanks
>
>
>
Received on Thu Jan 20 2000 - 03:58:40 CST

Original text of this message

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