sequence

--删除 sequence

drop sequence SEQ_T_PROJECT_COMMENT 


-- 创建 Create sequence
create sequence SEQ_T_PROJECT_COMMENT
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
cache 10;

update T_PROJECT_COMMENT set id=seq_id.nextval ;

--查询sequence 的值

SELECT SEQ_T_PROJECT_COMMENT.NEXTVAL AS DN_LOG_ID FROM DUAL;
select 序列名.Nextval from dual;--生成并获得下一个序列


create sequence seq_id start with 1000 increment by 1 ;

update t set id=seq_id.nextval ;

 
原文地址:https://www.cnblogs.com/sweet22353/p/10538264.html