-- 批量删除job declare v_exist number(2); -- job是否存在 begin for x in 1..8 LOOP select count(1) into v_exist from user_scheduler_jobs WHERE job_name = ‘PROCESS_BILL_DATA_‘ || x ; if v_exist > 0 then dbms_scheduler.drop_job(job_name => ‘PROCESS_BILL_DATA_‘ || x,force => TRUE); dbms_output.put_line(‘drop job :‘ || x ); end if; end loop; end; / -- 查看pl/sql output页签输出,显示日志,删除job的个数 -- 批量创建job 8个 declare begin for x in 1..8 LOOP sys.dbms_scheduler.create_job(job_name => ‘PROCESS_BILL_DATA_‘ || x, job_type => ‘PLSQL_BLOCK‘, job_action => ‘begin process_bill_data(8,‘||(x-1)||‘,10000,500); end;‘, start_date => to_date(‘06-08-2013 16:26:05‘, ‘dd-mm-yyyy hh24:mi:ss‘), repeat_interval => ‘FREQ=MINUTELY;INTERVAL=1;‘, end_date => to_date(null), job_class => ‘DEFAULT_JOB_CLASS‘, enabled => true, auto_drop => true, comments => ‘清单数据处理_‘||x); dbms_output.put_line(‘create job :‘ || x ); end loop; end; /
原文地址:https://www.cnblogs.com/fubinhnust/p/9928642.html
时间: 2024-10-08 06:57:56