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?

    Requires Free Membership to View

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 first published in January 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: