create or replace procedure
reset_seq(seq_name in varchar2)
is
cur_val number;
begin
execute immediate
'select '||seq_name||'.nextval from dual' into cur_val;
execute immediate
'alter sequence '||seq_name||' increment by -'||cur_val||' minvalue 0';
execute immediate
'select '||seq_name||'.nextval from dual' into cur_val;
execute immediate
'alter sequence '||seq_name||' increment by 1 minvalue 0';
end;
当前位置: 数据库>oracle
Oracle Sequence 清零
来源: 互联网 发布时间:2017-04-03
本文导语: create or replace procedure reset_seq(seq_name in varchar2) is cur_val number; begin execute immediate 'select '||seq_name||'.nextval from dual' into cur_val; execute immediate 'alter s...