I want to schedule a dbms scheduler job in plsql developer to run every day from 4pm to 6am and the frequency within this range should be every 15 minutes. and a second job to run 6am to 4pm. I am not 100% sure how to do it but i thought about writing a small code in the job action before calling my package which checks the sysdate.If its within range go on and if not return null. But how do I check if sysdate is currently between 06pm and 06am?
The below code is not working. I have also tried using to_date('16:00', 'HH24:MI')
begin
if to_char(sysdate, 'HH24:MI') between to_char('16:00', 'HH24:MI') and to_char('06:00', 'HH24:MI') then
dbms_output.put_line('within range');
-- call loader package
else
dbms_output.put_line('not within range');
-- return null do nothing
end if;
end;
Thank you all.