Q

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

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close