oracle-based serial number

*, oracle query the next serial number

select sequence name.nextval from dual;

 

*, the maximum ID of the total amount of manually added data - the maximum ID manually entered

maxId

 

*, oracle modifies the step value of the sequence

alter sequence sequence name increment by (maxId - current sequence number);

 

*, oracle must execute the following line

select sequence name.nextval from dual;

 

*, oracle changes the step size of the sequence to the initial span value

alter sequence sequence name increment by 1;

 

*, oracle must execute the following line

select SEQ_PM_FUNDING_DETAIL.nextval from dual;

 

At this point, the oracle's sequence adjustment is complete!

 *, query step size based on oracle sequence

select sequence_name,increment_by,cycle_flag,cache_size from user_sequences;

 

-------------------------------------------------- - Gorgeous base points --------------------------------------- --------------------

*, sequence creation syntax

CREATE SEQUENCE SEQ_TEST--pay attention to abide by certain rules for later association and operation
INCREMENT BY 1 -- add a few at a time
START WITH 1 -- count from 1
NOMAXvalue -- do not set the maximum value
NOCYCLE -- keep accumulating, not looping
CACHE 10; --Set the cache sequence, if the system is down or other circumstances will cause the sequence to be discontinuous, it can also be set to ---------NOCACHE

 

-------------------------------------------------- -Gorgeous dividing line-------------------------------------------- --------------------

resource link

oracle的序列步长知识

http://blog.itpub.net/29785807/viewspace-1273138/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326615273&siteId=291194637