|
|
在ORalce 中,怎么判断两个时间段之间是否有交集, 编写的一个函数. |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
判断2个时间段是否有交集的函数,开始是在我计算考勤的时候有用过, 后来发现用到的地方越来越多, 丢个砖头  9i 下通过.
两个时间段 之间是否有交集 intime---outtime fromdate--todate 如果有交集,则返回1,否则返回0 */ create or replace function func_IsTimeCross(intime in date, outtime in date, fromdate date , todate date ) return number is Result number; begin Result :=0; if (fromdate<intime) then --请假的开始时间<当天应上班的时间 if (todate>=outtime) then --请假的结束时间>=当天应下班时间 说明有交集 Result :=1; end if; end if; if (fromdate>=intime) then -- 如果请假开始时间>应上班时间,只要在下班时间之前,则也说明有集 if (fromdate<=outtime) then Result :=1; end if; end if ; return(Result); end func_IsTimeCross;

|
|
相关文章:相关软件: |
|