1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Oracle自增主键的添加[sequence]--表数据已存在

Oracle自增主键的添加[sequence]--表数据已存在

时间:2018-12-02 17:17:22

相关推荐

Oracle自增主键的添加[sequence]--表数据已存在

--增加主键IDalter table CLERK_COMPARE add id number(16);--设置sequence使ID自增create sequence SEQ_IDminvalue 1maxvalue 999999999start with 1;--将id的值设置为sequenceUpdate clerk_compare set id=seq_id.nextval;commit;--设置id为主键 alter table CLERK_COMPAREadd constraint CLERK_COMPARE primary key (ID);

View Code

create sequence SEQ_CLERK_COMPARE_ID minvalue 1 maxvalue 9999999999999990 start with 1 increment by 1 cache 2000 noorder ;

View Code

补充:

1:一个sequence可以被多个表共享。

2:被多个表共享的sequence生成的数字序列始终连续,不会重新开始。

3:如果不再使用的sequence请删除。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。