timesten中建sequence和oracle不一样的。

来源:互联网 发布:网络大电影导演招聘 编辑:程序博客网 时间:2024/06/07 10:02
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
原创粉丝点击