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: select with between date/time

Re: select with between date/time

From: Xavier Neys <xavier.neys_at_12move.nl>
Date: Sat, 25 Aug 2001 09:51:11 +0200
Message-ID: <9m7lbd$cif$1@news1.xs4all.nl>


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
ralf
Received on Sat Aug 25 2001 - 02:51:11 CDT

Original text of this message

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