Oracle函数
--控制job执行时间(8:00--17:30)
--在时间区间内,每半小时执行一次,否则第二天8:00执行
function nextruntime return date is
d_next date;
begin
select decode(sign((7 - to_number(to_char(sysdate,
'hh24'))) *
(18 - to_number(to_char(sysdate,
'hh24')))),
-1,
trunc(sysdate,
'mi') + 0.5 / 24,
trunc(sysdate + 1) + 8 / 24)
into d_next
from dual;
return d_next;
end;