在服务器A 建立SEQUENCE, 服务器B的通过 DB LINK方式访问服务器A的SEQUENCE,自然就是同步的.
不想用DBLink去访问,就是因为怕源服务器坏掉,才定期同步的。
alter sequence SEQ_ASEQ increment by 53127 nocache; select SEQ_ASEQ.nextval from dual; alter sequence SEQ_ASEQ increment by 1 nocache; declare LastValue integer; begin loop select SEQ_ASEQ.currval into LastValue from dual; exit when LastValue >= 59030 - 1; select SEQ_ASEQ.nextval into LastValue from dual; end loop; end; / alter sequence SEQ_ASEQ increment by 1 cache 20;
alter sequence SEQ_ASEQ increment by 53127 nocache; select SEQ_ASEQ.nextval from dual; alter sequence SEQ_ASEQ increment by 1 nocache; declare LastValue integer; begin loop select SEQ_ASEQ.currval into LastValue from dual; exit when LastValue >= 59030 - 1; select SEQ_ASEQ.nextval into LastValue from dual; end loop; end; / alter sequence SEQ_ASEQ increment by 1 cache 20; 请问怎么修改SEUQUENCES 下一个值.
我想用存储过程里改变某个SEQUENCES 的值,怎问怎么写: 我运行上面朋友给写的 begin loop select SEQ_ASEQ.currval into LastValue from dual; exit when LastValue >= 59030 - 1; select SEQ_ASEQ.nextval into LastValue from dual; end loop; end; 出错了,提示未SEQ_ASEQ.currval 尚未在此会议中定义.
在一个会话中,要获取seq的currval值的话,必须先执行nextval 这就是为什么8楼在alter之前执行了 select SEQ_ASEQ.nextval from dual;
alter sequence SEQ_ASEQ increment by 53127 nocache;
select SEQ_ASEQ.nextval from dual;
alter sequence SEQ_ASEQ increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SEQ_ASEQ.currval into LastValue from dual;
exit when LastValue >= 59030 - 1;
select SEQ_ASEQ.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SEQ_ASEQ increment by 1 cache 20;
即sequences的步长为2
select SEQ_ASEQ.nextval from dual;
alter sequence SEQ_ASEQ increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SEQ_ASEQ.currval into LastValue from dual;
exit when LastValue >= 59030 - 1;
select SEQ_ASEQ.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SEQ_ASEQ increment by 1 cache 20;
请问怎么修改SEUQUENCES 下一个值.
我运行上面朋友给写的
begin
loop
select SEQ_ASEQ.currval into LastValue from dual;
exit when LastValue >= 59030 - 1;
select SEQ_ASEQ.nextval into LastValue from dual;
end loop;
end;
出错了,提示未SEQ_ASEQ.currval 尚未在此会议中定义.
这就是为什么8楼在alter之前执行了
select SEQ_ASEQ.nextval from dual;