Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: comparing a date?

Re: comparing a date?

From: Geoff Muldoon <geoff.muldoon_at_trap.gmail.com>
Date: Wed, 21 Jun 2006 09:27:12 +1000
Message-ID: <MPG.1f032f593503b6c898980e@news.readfreenews.net>


mh_at_pixar.com says...
> How do I compare a date to be equal to a particular day?
>
> For example, here's some dates in the all_users table:
>
> select * from all_users;
>
> USERNAME USER_ID CREATED
> ------------------------------ ---------- ---------
> MAB 235 20-JUN-06
> MPLANCK 234 20-JUN-06
> TBEST 233 20-JUN-06
>
> but if I just check for date equality, I don't match
> any rows:
>
> SQL> select * from all_users where created='20-JUN-06';
>
> no rows selected
>
> This query does the right thing:
>
> select * from all_users where created>'20-JUN-06' and created<'21-JUN-06';
>
> What's the proper way to compare a date column for a particular
> day, without respect to the time?

select * from all_users where trunc(created)='20-JUN-06';

GM Received on Tue Jun 20 2006 - 18:27:12 CDT

Original text of this message

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