
declare
    cursor timed_trans_cur is
	select job from user_jobs where what = 'workflow_case.sweep_timed_transitions;';
    cursor hold_timeout_cur is
	select job from user_jobs where what = 'workflow_case.sweep_hold_timeout;';
    job_no number;
begin

    open timed_trans_cur;
    fetch timed_trans_cur into job_no;
    if timed_trans_cur%NOTFOUND then
	dbms_job.submit(
	    job => job_no, 
	    what => 'workflow_case.sweep_timed_transitions;', 
	    interval => 'sysdate + 1/24/4'
	);
    else
	dbms_job.change(
	    job => job_no,
	    what => 'workflow_case.sweep_timed_transitions;', 
	    next_date => sysdate,
	    interval => 'sysdate + 1/24/4'
	);
    end if;

    open hold_timeout_cur;
    fetch hold_timeout_cur into job_no;
    if timed_trans_cur%NOTFOUND then
	dbms_job.submit(
	    job => job_no, 
	    what => 'workflow_case.sweep_hold_timeout;', 
	    interval => 'sysdate + 1/24/4'
	);
    else
	dbms_job.change(
	    job => job_no,
	    what => 'workflow_case.sweep_hold_timeout;',
	    next_date => sysdate,
	    interval => 'sysdate + 1/24/4'
	);
    end if;

end;
/
show errors;

