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 date to sysdate

Re: How to compare a date to sysdate

From: A-Friend <pippo_at_yahoo.com>
Date: Thu, 4 Mar 1999 12:12:05 +0100
Message-ID: <7blp9j$dmu$1@fe2.cs.interbusiness.it>

ramdan ha scritto nel messaggio ...
>why does this not work?!!?!?
>
>
>SQL> SELECT SYSDATE FROM DUAL;
>
>SYSDATE
>-----------
>02-mar-1999
>
>
>SQL> select * from tab1row where readdate = (select sysdate from dual);
>
>no rows selected
>
>SQL> select * from tab1row where readdate = sysdate;
>
>no rows selected
>

[snip]

Because the value of hours, minutes and so on into the table are not the same of those of the sysdate...
Try this statement:

SQL> select * from tab1row where to_char(readdate,'dd-mon-yyyy') = to_char(sysdate,'dd-mon-yyyy');

or

SQL> select * from tab1row where to_char(readdate,'dd-mon-yyyy') = (select to_char(sysdate,'dd-mon-yyyy') from dual);

Bye Received on Thu Mar 04 1999 - 05:12:05 CST

Original text of this message

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