架构师之如何精确修改序列当前值?

1.前言
  如题。序列不支持直接修改当前值和最小值。可以间接用alter修改步长,select后再修改回来。或者直接存储过程select.本文建议第二种。
2.第二种代码。

declare 
  a number;
  b number;
begin
   select test into a   from dual;
   select max(id) into b from  test;
   for i in a..(b+1)
    loop
        select SEQ_test into a   from dual;
    end loop;
end;


3.注意。
b+1或者b都行,这里多加了个1

猜你喜欢

转载自nannan408.iteye.com/blog/2248456