兩個(gè)時(shí)間段 之間是否有交集 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 --請假的開始時(shí)間<當(dāng)天應(yīng)上班的時(shí)間 if (todate>=outtime) then --請假的結(jié)束時(shí)間>=當(dāng)天應(yīng)下班時(shí)間 說明有交集 Result :=1; end if; end if; if (fromdate>=intime) then -- 假如請假開始時(shí)間>應(yīng)上班時(shí)間,只要在下班時(shí)間之前,則也說明有集 if (fromdate<=outtime) then Result :=1; end if; end if ; return(Result); end func_IsTimeCross;