Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to compare a datetime field to a Date
md9_at_ibest.com.br wrote:
> Hi Tony,
>
> Thank you for your answer.
> I already solved this way
> where to_date(dh_entrada) = to_date('18/10/2004')
>
> Regards,
> Marcello Dias
However, this 'solution' won't work, *except* if dh_entrada does not contain any time information, i.e on insert and update the values are truncated. And in that case, your to_date shouldn't be necessary:
baer_at_DEMO10G>alter session set nls_date_format='DD.MM.YYyy hh24:MI';
Session altered.
baer_at_DEMO10G>select to_date (sysdate) from dual;
TO_DATE(SYSDATE)
baer_at_DEMO10G>select trunc(sysdate) from dual;
TRUNC(SYSDATE)
HTH
Holger
Received on Wed Oct 20 2004 - 03:42:25 CDT