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 -> How to select within a time range

How to select within a time range

From: Ramon F Herrera <ramon_at_conexus.net>
Date: 6 Jun 2003 22:43:09 -0700
Message-ID: <c9bc36ff.0306062143.2f68f2d4@posting.google.com>


I am trying to match a phone bill sent to our company with the records that we keep. If our clock and the phone company's clock were perfectly synchronized, something like the following would suffice:

select name from calls where day = '12-feb-03' and call_time = '09:43:10';

but in this imperfect world, I will need to have some range like:

select name from calls where
day = '12-feb-03' and call_time >= '09:42:55' and call_time <= '09:43:25';

Since the above values are going to be variables, I need some sort of time function to verify the inequality:

      $time - 10 seconds <= $fixed_time <= $time + 10 seconds

I would like to make sure that the above works across days.

In Unix, I would convert all the dates to seconds, before checking to see if a particular date falls inside the range, but how should I do this in SQL? Should I change everything to seconds?

TIA, -Ramon F. Herrera Received on Sat Jun 07 2003 - 00:43:09 CDT

Original text of this message

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