兩個時間段 之間是否有交集 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; 注冊會員,創建你的web開發資料庫,