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

给oracle写自增序列

2016-01-26 15:41 363 查看

1.新建表结构

<span style="font-size:32px;">create table tb_user (
userId             INTEGER                         not null,
userName           CHAR(20),
constraint PK_TB_USER primary key (userId)
)</span>


2.新建自增序列

<span style="font-size:32px;">create sequence tb_user_id
increment by 1
start with 0
maxvalue 10000
minvalue 0
nocycle
cache 20
order;</span>

3.插入数据

<span style="font-size:32px;">insert into tb_user(userId,userName) values(tb_user_id.nextval,'刘云生')</span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: