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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Help with date calculation

RE: Help with date calculation

From: Shaw, Glen <Glen.Shaw_at_BellSouth.com>
Date: Thu, 16 Nov 2000 14:21:54 -0500
Message-Id: <10682.122291@fatcity.com>


Loren,

There are a 3 ways I can think of to approach this. 1. select *

      from timetable 
     where trunc((sysdate - to_date('01-Jan-1970','DD-Mon-YYYY')) * 86400) -
bdate > 1200;

2. select *

      from timetable 
     where (SysDate - (to_date('01-Jan-1970', 'DD-Mon-YYYY') +
(bdate/86400)))*1440 > 20

3. Add a date column to the table and a supporting index.

    Add an Insert/Update trigger to the process that calculates and populates

      the date field based on the numeric value.     Then:     

    select *

      from timetable 
     where datefield > (sysdate - (20/1440));

Number 3 is my preferred option because it allows an indexed search.

Hope this helps,
Glen

-----Original Message-----
From: LOREN SUMMERS [mailto:loren_summers_at_yahoo.com] Sent: Thursday, November 16, 2000 1:17 PM To: Multiple recipients of list ORACLE-L Subject: RE: Help with date calculation

Djordje,
I was pretty sure about the first one but I am not sure whether this is correct.
Can someone help mw with this date calculation. Really appreciate your help.

Thanks
Problem

All records where sydate - bdate > 20 minutes bdate is stored in seconds from 1970..
select * from timetable
 where

(sysdate-20/1440)-to_date('01-JAN-1970','DD-MON-YYYY')+bdate(24*60*60)>20);


Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays! http://calendar.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: LOREN SUMMERS
  INET: loren_summers_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
Received on Thu Nov 16 2000 - 13:21:54 CST

Original text of this message

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