tags:

views:

140

answers:

2

I have a column that stores the last modified date. I want to check in a SQL query if its value is more than 2 months from the current date.

I know I need to use SYSDATE but am not familiar with date stuff in Oracle so am unsure as to the rest.

+6  A: 
 SELECT * from table where date_column >= add_months(TRUNC(SYSDATE) + 1, 2);
Mercer Traieste
I'd make it `>= add_months(TRUNC(SYSDATE) + 1, 2)`. This type of condition usually assumes the date only, not datetime.
Quassnoi
You're right!
Mercer Traieste
A: 

try this

SELECT field1,field2 from yourtable where field_date > add_months(SYSDATE, 2);

Bye

RRUZ