在 Oracle 中,可以使用 OVERLAPS
运算符来判断两个时间段之间是否存在交叉。
例如,假设有一个表 schedule
,其中有两个字段 start_time
和 end_time
,表示某个时间段的开始时间和结束时间。
如果要查询与某个给定的时间段存在交叉的时间段,可以使用如下的 SQL 语句:
SELECT *
FROM schedule
WHERE start_time OVERLAPS TO_TIMESTAMP(:start_time, 'YYYY-MM-DD HH24:MI:SS')
AND end_time OVERLAPS TO_TIMES