序列的应用

  • oracle特有的产物,不占内存,不占磁盘,就是生产间隔的数字的,用于id的自增长
  • 等于模拟mysql的id自增长

查询全部序列

1
select * from all_sequences 

创建序列

1
2
3
4
5
6
create sequence 序列名字
minvalue 1
maxvalue 9999999999999999999999999999
start with 1
increment by 1
cache 20;

删除序列

1
DROP SEQUENCE 序列名字

查询指定序列

1
select * from all_sequences where SEQUENCE_NAME = '序列名字'