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

oracle怎样实现自增

2016-09-14 15:08 134 查看
第一步:创建表

create table Test_Table 

ID number(11) primary key, 
Name varchar(50) not null, 
Value1 varchar(50) not null 


第二步:创建一个自增序列以此提供调用函数。 

create
sequence Seq_Test_Id 
start with 1 //根据需要自己可修改该数值 
increment by 1 //步长值 
minvalue 1 
nomaxvalue 

到此可以实现自增,新增记录如下:

Insert into Test_Table(ID,Name,Value1)values(Seq_Test_Id.nextval,'xiyang','blog')
;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  oracle