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: Date Comparison

Re: Date Comparison

From: Scott Mattes <smattes_at_erols.com>
Date: 1996/12/13
Message-ID: <58qgsn$jqe@boursy.news.erols.com>#1/1

I know this one (I think)!

I ran into this also when I started working with Oracle. This happens because a date field is really a date and the time (and, to complicate matters, the default display format for a date field is just the date, so you don't see the date/time). If you store just a date what is actually stored is the date and 12:00. In your example you are storing the current date AND time! You can see this by redefining the output display of this field to show date and time, or you can use a function to compare just the date part of the table field (don't have the books handy, sorry), or you could change your query to include the 12:00 (or is it 12:00:00).

Steve Dirschel <steve_dirschel_at_cargill.com> wrote:

>Could someone please explain this to me:
 

>Create table dummy (a date);
 

>Insert into dummy values (sysdate);
>Insert into dummy values (sysdate);
>Commit;
 

>Select * from dummy;
>10-DEC-96
>10-DEC-96
 
>Select * from dummy where a = '10-DEC-96'
 

>0 rows selected
 

>Select * from dummy where a > '10-DEC-96'
>10-DEC-96
>10-DEC-96
>2 rows selected
 

>Why do I not get 2 rows returned when I try the select * from dummy
>where a = '10-DEC-96' ? I realize I can do a "less than 11-DEC-96 and
>greater than 10-DEC-96" but it seems like I shouldn't have to do all
>of that typing.
 

>Thanks in advance



Scott Mattes
smattes_at_erols.com

Don't support forced abortions -- boycott 'made in China'!

Check out the U. S. Taxpayers' Party at www.ustaxpayers.org

Watch your government employees at http://www.vote-smart.org Received on Fri Dec 13 1996 - 00:00:00 CST

Original text of this message

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