Timesten语法:
CREATE SEQUENCE [Owner.]SequenceName[INCREMENT BY IncrementValue][MINVALUE MinimumValue][MAXVALUE MaximumValue][CYCLE][CACHE CacheValue][START WITH StartValue]
主要的区别应该是cycle这里,在timesten中序列默认是不重复的。跟oracle正好相反。
Indicates that the sequence number generator continues to generatenumbers after it reaches the maximum or minimum value. Bydefault, sequences do not cycle. Once the number reaches themaximum value in the ascending sequence, the sequence wrapsaround and generates numbers from its minimum value. For adescending sequence, when the minimum value is reached, thesequence number wraps around, beginning from the maximum value.If CYCLE is not specified, the sequence number generator stopsgenerating numbers when the maximum/minimum is reached andTimesTen returns an error.
oracle语法:
create sequence emp_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
CACHE 10;
在oracle中sequence默认是重复的,要显式声明 NOCYCLE
CREATE SEQUENCE [Owner.]SequenceName[INCREMENT BY IncrementValue][MINVALUE MinimumValue][MAXVALUE MaximumValue][CYCLE][CACHE CacheValue][START WITH StartValue]
主要的区别应该是cycle这里,在timesten中序列默认是不重复的。跟oracle正好相反。
Indicates that the sequence number generator continues to generatenumbers after it reaches the maximum or minimum value. Bydefault, sequences do not cycle. Once the number reaches themaximum value in the ascending sequence, the sequence wrapsaround and generates numbers from its minimum value. For adescending sequence, when the minimum value is reached, thesequence number wraps around, beginning from the maximum value.If CYCLE is not specified, the sequence number generator stopsgenerating numbers when the maximum/minimum is reached andTimesTen returns an error.
oracle语法:
create sequence emp_sequence
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
CACHE 10;
在oracle中sequence默认是重复的,要显式声明 NOCYCLE
本文对比了Timesten和Oracle中序列创建语法的主要区别。重点介绍Timesten中序列默认不循环,而Oracle中序列默认循环,并提供了两个数据库系统中创建序列的具体语法示例。
946

被折叠的 条评论
为什么被折叠?



