一句sql是不能够实现的,还不如直接drop再create呢? 比如一个sequence(当前序列值为5523202)如下 -- Create sequence create sequence SEQ_WXTHCOUNT minvalue 1 maxvalue 99999999 start with 5523202 increment by 1 cache 20; 修改当前序列值为23的过程要经过一系列步骤,如下: -- Modify the last number alter sequence SEQ_WXTHCOUNT increment by -5523179 nocache; select SEQ_WXTHCOUNT.nextval from dual; alter sequence SEQ_WXTHCOUNT increment by 1 nocache; declare LastValue integer; begin loop select SEQ_WXTHCOUNT.currval into LastValue from dual; exit when LastValue >= 23 - 1; select SEQ_WXTHCOUNT.nextval into LastValue from dual; end loop; end; / alter sequence SEQ_WXTHCOUNT increment by 1 cache 20;
比如一个sequence(当前序列值为5523202)如下
-- Create sequence
create sequence SEQ_WXTHCOUNT
minvalue 1
maxvalue 99999999
start with 5523202
increment by 1
cache 20;
修改当前序列值为23的过程要经过一系列步骤,如下:
-- Modify the last number
alter sequence SEQ_WXTHCOUNT increment by -5523179 nocache;
select SEQ_WXTHCOUNT.nextval from dual;
alter sequence SEQ_WXTHCOUNT increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SEQ_WXTHCOUNT.currval into LastValue from dual;
exit when LastValue >= 23 - 1;
select SEQ_WXTHCOUNT.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SEQ_WXTHCOUNT increment by 1 cache 20;