負の増分を使用して、シーケンスをより低い値にリセットできます。このスクリプト(これはPL / SQLブロックバージョンです)は、9999より大きいシーケンス値で問題なく機能します):
declare
currval pls_integer;
diff pls_integer;
begin
select SQ_USER_ID.nextval into currval from dual;
dbms_output.put_line('value before alter: ' || currval);
diff := 99999 - currval;
dbms_output.put_line('diff: ' || diff);
execute immediate ' alter sequence SQ_USER_ID INCREMENT BY ' || diff || 'nocache';
select SQ_USER_ID.nextval into currval from dual;
dbms_output.put_line('value after alter: ' || currval);
execute immediate 'alter sequence SQ_USER_ID INCREMENT BY 1 cache 20';
end;