Return to Snippet

Revision: 27381
at June 4, 2010 09:20 by mprabhuram


Initial Code
-- Overlap present

select 'YES' as overlap from dual
    where          (date '2007-01-01', date '2008-01-01')
          overlaps (date '2005-01-01', date '2009-01-01')


OVE
---
YES

-- Overlap not present

select 'YES' as overlap from dual
    where          (date '2007-01-01', date '2008-01-01')
          overlaps (date '2005-01-01', date '2006-01-01')


no rows selected.

Initial URL
http://oraclesponge.wordpress.com/2008/06/12/the-overlaps-predicate/

Initial Description
This function can be used to find out if there exists an overlap between two pairs of dates or time.

There is an alternate way to calculate the actual overlapping value - Read the snippet "How to avoid double counts"

Initial Title
Oracle - Overlaps function

Initial Tags
sql, Oracle

Initial Language
SQL