/ Published in: SQL
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"
There is an alternate way to calculate the actual overlapping value - Read the snippet "How to avoid double counts"
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
-- 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.
URL: http://oraclesponge.wordpress.com/2008/06/12/the-overlaps-predicate/