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: Guido vd Zweerde <JAZA_at_msg.ti.com>
Date: 1996/12/13
Message-ID: <01bbe8e6$86deefa0$77025982@civ002119.civ.utwente.nl>#1/1

Steve Dirschel <steve_dirschel_at_cargill.com> wrote in article <32B08532.5354_at_cargill.com>...
> 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

When you insert the date like that, the date also contains a time stamp. If you insert the dates as follows :
Insert into dummy values (trunc (sysdate)); Insert into dummy values (trunc (sysdate)); Commit;

You'll remove the time-stamp and the comparison with 'DD-MON-YY' will result is the return of the two rows.

regards,
Guido vd Zweerde
Universiteit Twente Received on Fri Dec 13 1996 - 00:00:00 CST

Original text of this message

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