Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: select with between date/time
Hi Ralf,
Use a where clause that looks like this:
date_to_test between (trunc(sysdate)-5/24) and (trunc(sysdate)+4/24)
or maybe you find this more readable
date_to_test between (trunc(sysdate-1)+19/24) and (trunc(sysdate)+4/24)
trunc(sysdate) gives today at 00:00:00
+1/24 adds an hour
+1/24/60 adds a minute
+1/24/60/60 adds a second
You can even add seconds like this in a loop and Oracle will give the expected time. Not the case at all in MS vba tools :-)
HTH,
-- Today, Tomorrow, Together The DOC (The Dutch Oracle Company) Xavier. "Ralf Bender" <ralf.bender_at_nexgo.de> wrote in message news:20010824.21041019_at_mis.configured.host... hello i want to write a select statement which tells me all rows between yesterday 07:00PM and today 04:00AM, BUT i don't know how. i want save this as pl/sql statement, which must run every day. so it doesn't help to write a fix time. I try with sysdate-1, but there's not my selected time range... Can someone tell how to write such select? thx ralfReceived on Sat Aug 25 2001 - 02:51:11 CDT
![]() |
![]() |