Oracle 还原序列
代码
declare
n number(10);
tsql varchar2(100);
begin
select SEQ_APP_INFO_ADBIT_ID.nextval into n from dual;
n:=-(n-1);
tsql:= 'alter sequence SEQ_APP_INFO_ADBIT_ID increment by '|| n;
execute immediate tsql;
select SEQ_APP_INFO_ADBIT_ID.nextval into n from dual;
tsql:= 'alter sequence SEQ_APP_INFO_ADBIT_ID increment by 1 ';
execute immediate tsql;
end;
n number(10);
tsql varchar2(100);
begin
select SEQ_APP_INFO_ADBIT_ID.nextval into n from dual;
n:=-(n-1);
tsql:= 'alter sequence SEQ_APP_INFO_ADBIT_ID increment by '|| n;
execute immediate tsql;
select SEQ_APP_INFO_ADBIT_ID.nextval into n from dual;
tsql:= 'alter sequence SEQ_APP_INFO_ADBIT_ID increment by 1 ';
execute immediate tsql;
end;