oracle创建表和序列

1.建表

create table tb_od_acceptworkorder
(
   id                INTEGER primary key not null,
   caseid             VARCHAR2(100)        not null,
   city               VARCHAR2(80),
);
--添加注释
comment on table tb_od_acceptworkorder  '自受理工单';
comment on column tb_od_acceptworkorder.id '主键';
comment on column tb_od_acceptworkorder.caseid  '工单号';

2.创建序列

--创建序列
create sequence ACCEPTWORKORDER_ID_SEQ
start with 1                 --从1开始,不能小于最小值
maxvalue 9999999999999999999 --设置最大值
minvalue 0                   --设置最小值
nocycle                      --一直累加,不循环
cache 5000                   --缓存,表示一次产生5000个序号
noorder;

3.查看序列

--查看以创建的序列
select * from user_sequences;
--模糊搜索,序列
select * from user_sequences  where  sequence_name like '%MY%';
--序列名.currval 查看当前序列是多少
select ACCEPTWORKORDER_ID_SEQ.currval  from dual
--序列名.nextval 查看序列的下一个值
select ACCEPTWORKORDER_ID_SEQ.nextval from dual


使用plsql建表
1.点击Tables右键,新建







猜你喜欢

转载自blog.csdn.net/mzy755423868/article/details/80569791