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

Home -> Community -> Usenet -> c.d.o.tools -> date arithmetic in oracle?

date arithmetic in oracle?

From: bmt <bmatthewtaylor_at_hotmail.com>
Date: 2000/04/30
Message-ID: <390BBBC4.1238CC95@hotmail.com>#1/1

I want to select on the basis of date arithmetic.. ie

create table TABLEX (A varchar(10), B date); insert into tablex values ('number1', ( to_date ( '10-Jan-2000',
'dd-Mon-yyyy','NLS_DATE_LANGUAGE = American') ));
insert into tablex values ('number2', ( to_date ( '20-Jan-2000',
'dd-Mon-yyyy','NLS_DATE_LANGUAGE = American') ));

and I want to select * from TABLEX where date < (sysdate-7days)  any ideas??

I know I can do
select * from tablex where b < (select sysdate from dual); to get where date < sysdate.

and can do
select * from tablex where b < (SELECT ADD_MONTHS(SYSDATE, -1) FROM DUAL);
 to get where date < sysdate - 1 month.

As far as I can tell there is no add_days or add_weeks function. Any ideas??

M



Matthew Taylor s176226_at_student.uq.edu.au ph 3202 6927/3202 9040/0417 833 021 bmatthewtaylor_at_hotmail.com University of Queensland, St Lucia, Brisbane, Australia.
Received on Sun Apr 30 2000 - 00:00:00 CDT

Original text of this message

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