Q
Problem solve Get help with specific problems with your technologies, process and projects.

Working with dates in Oracle

I have a table that contains two dates, "vis_dt1" and "vis_dt2." I want to find all "vis_dt2 dates" that fall outside a certain window, e.g. 144 - 260 days after "vis_dt1", but including "vis_dt1". I know Oracle gives me the days between, but how do I adjust for the first day? Is there a general rule for date arithmetic like this?
I think in your "where clause" specifying the following condition to address your requirement:

TRUNC(vis_dt2) NOT BETWEEN trunc(visdt1+144) and trunc(visdt1+260)
AND trunc(vis_dt2) >= trunc(vis_dt1)

This was last published in January 2005

Dig Deeper on Using Oracle PL-SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close