/ Published in: SQL
URL: http://oraclesponge.wordpress.com/2008/06/12/the-overlaps-predicate/
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"
Expand |
Embed | Plain Text
-- 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.
You need to login to post a comment.
