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: How to compare a datetime field to a Date

Re: How to compare a datetime field to a Date

From: Holger Baer <holger.baer_at_science-computing.de>
Date: Wed, 20 Oct 2004 10:42:25 +0200
Message-ID: <cl58di$qn5$1@news.BelWue.DE>


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)



20.10.2004 10:38

baer_at_DEMO10G>select trunc(sysdate) from dual;

TRUNC(SYSDATE)



20.10.2004 00:00

HTH
Holger Received on Wed Oct 20 2004 - 03:42:25 CDT

Original text of this message

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