先alter sequence .. increment by value
再执行select ..nextval from dual;
也可以实现啊

解决方案 »

  1.   

    当然是alter sequence.............................这儿好多菜鸟啊!
      

  2.   

    zmgowin 能给出比较完整的alter sequence 语句吗?谢谢
      

  3.   

    一句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;