用法:
create sequense my_seq //創建序列名:my_seq
start with 1 //從1開始
increment by 1 //每次增長1
maxvalue 999999 //nomaxvalue(不設置最大值) ---最大值
minvalue 1 //最小值
cycle //nocycle 一直累加,不循環 ;cycle 表示循環
nocache ---緩存
//cache 10 表示一次產生10個號,
//但是使用緩存產生號,優點是提高效率,缺點是可能產生跳號
//上面表示從1開始,每次增長1,最大值為999999,之后又循環開始
例:
--創建序列
create sequence index_id
start with 1
increment by 1
nomaxvalue
minvalue 1
nocycle;
--刪除序列
drop sequence index_id;
--查詢下一個序列
select index_id.nextval from dual;
--查詢當前序列
select index_id.currval from dual;
原文鏈接:https://blog.csdn.net/zhengqiqiqinqin/article/details/9068923