一、赋予用户创建和删除sequence的权限
grant create any sequence to user_name;
grant drop any sequnce to user_name;
二、查看job设置
show parameter job
如果job_queue_processes=0 ,那么将该值更新为1
alter system set job_queue_processes=1;
三、创建存储过程用于删除和创建sequence
create or replace procedure ClearSeq as
n_count number(8);begin select count(1) into n_count from user_sequences t where t.sequence_name = 'SEQ_ID'; if n_count > 0 then execute immediate 'drop sequence SEQ_ID'; end if; execute immediate 'create sequence SEQ_ID minvalue 1 maxvalue 99999999 start with 1 increment by 1 NOCYCLE NOCACHE'; commit;end;四、创建job执行上述存储过程
declare
job number; beginsys.dbms_job.submit(job,'clearseq;',sysdate,'sysdate+1');end;