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: sysdate & date columns

Re: sysdate & date columns

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 23 Jan 2000 00:33:31 GMT
Message-ID: <86di8r$alt$6@news.seed.net.tw>

dave mausner <dmausner_at_ameritech.x.net> wrote in message news:8EC16734Bdlm_at_206.141.192.241...

> >Larry Pettit <larry.pettit_at_ps.net> a écrit dans le message :
> >YTrh4.134$j4.7687_at_news.uswest.net...
> >>
> >> select * from table1 where date1 = sysdate
> >> Is there a way to compare a date column with sysdate other than
> >> converting both using to_char()?
>
> select ... from T where date1 between trunc(sysdate)
> and trunc(sysdate+1)-1/24/60/60
>
> in other words, between today at midnite and today at 23:59:59.
> it will use index on date1 if present.

This works in Oracle.
But, if the database is DB2 or SQL Server, this way is wrong. Received on Sat Jan 22 2000 - 18:33:31 CST

Original text of this message

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