您的位置:首页 >> 数据库 >> Oracle >> 正文
RSS
 

序列发生器取值不连续问题请教?

http://www.rdxx.com 05年11月10日 00:00 ChinaUnix.net 我要投稿

关键词: 序列发生器 , 问题

我建了一个序列发生器,语法如下:
drop sequence cardno_sequence;
create sequence cardno_sequence
increment by 1
start with 100001
maxvalue 999999
nocycle
cache 10;

然后用下列语句取值select cardno_sequence.nextval into :ls_xh from dual;

在使用过程中发现,取出的值不连续。比如上一次值是100101
可接下来的就是100115了。没有连续上来而且出现的次数比较多。请问为什么,我该怎么修改。谢谢。

 airlily 回复于:2003-08-25 10:26:09
这是sequence可能出现不连续取值的几种情况:

Gaps in the Sequence

Although sequence generators issue sequential numbers without gaps, this action occurs independent of a commit or rollback. Therefore, if you roll back a statement containing a sequence, the number is lost.

Another event that can cause gaps in the sequence is a system crash. If the sequence caches values in the memory, then those values are lost if the system crashes.

Because sequences are not tied directly to tables, the same sequence can be used for multiple tables. If you do so, each table can contain gaps in the sequential numbers.

 sylpjx 回复于:2003-08-25 10:46:18
no  cache一把你的取值就连续了,因为ORACLE预置20个,当你结束的时候,就会把剩余的没有用的丢弃掉,所以就不连续了。

 zlxfei 回复于:2003-08-25 18:29:18
up


 
 
标签: 序列发生器 , 问题 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站