Oracle 序列的创建删除插入

今天学习的是序列的创建蟹盖和删除插入

创建:

create Sequence Seq_name

increment by n     ----序列变化的程度,默认为1,可以为负数表示递减

start with n           ----序列的初始值,默认值为1

maxvalue n          ----序列的最大值,必须大于start的值

minvalue n           ----序列的最小值,小于start的值

cycle                    ----表示达到限制以后是否循环(nocycle--不循环,cycle--循环)

cache  n              ----缓存序列的个数,默认值为20,不使用则为nocache

 

修改与删除

修改与删除直接将create改为alter和drop即可,但是需要注意,不能修改start值

 

插入

先创建一个表

create table test(

tid number primary key,

t_name varchar2(2),

);

创建序列

create sequence seq_test

increment  by 1

start with 10

maxvalue  100

cycle

cache 10

插入序列

insert into test values(seq_test.nextval, '序列号');

 

posted @ 2018-11-15 22:53  吾名王道长  阅读(125)  评论(0编辑  收藏  举报