Sequence in Oracle is a so-called serial number in oracle. It is automatically added each time it is obtained. It is generally used in places where the sequence numbers need to be sorted. Www.2cto.com 1. create sequence you must have the create sequence or create any sequence permission first, create sequence emp_sequence increment by 1 -- add several start with 1 each time -- count NOMAXVALUE from 1 -- do not set the maximum value NOCYCLE -- accumulate all the time, do not loop CACHE 10; once emp_sequence is defined, you can use CURRVAL, NEXTVALCURRVAL = to return the current sequence Value NEXTVAL = to increase the sequence value, and then return the sequence value, for example, emp_sequence.CURRVALemp_sequence.NEXTVAL www.2cto.com, where sequ: -SELECT statements that do not contain subqueries, snapshot, and VIEW- The following example shows how to insert into emp VALUES (em1_q. nextval, 'Lewis ', 'cler', 7902, SYSDATE, 1200, NULL, 20); SELECT em1_q. currval from dual; but note:-the first NEXTVAL returns the initial value. The subsequent NEXTVAL automatically increases the value of your defined increment by and then returns the added value. CURRVAL always returns the value of the current sequence, but CURRVAL can be used only after the first NEXTVAL initialization; otherwise, an error will occur. NEXTVAL increases the sequence value once. Therefore, if you use multiple NEXTVAL values in the same statement, their values are different. Understand? -If the CACHE value is specified, oracle can place some sequence in the memory in advance, so that the access speed is faster. After the cache is obtained, oracle automatically retrieves another group to the cache. The cache may be skipped. For example, if the database suddenly fails to be shut down (shutdown abort), the sequence in the cache will be lost. Therefore, nocache can be used to prevent this situation when creating sequence. Www.2cto.com 2. Alter sequence you are either the owner of the sequence, or you have the alter any sequence permission to modify the sequence. You can alter all sequence parameters except the start value. If you want to change the start value, you must drop sequence and then re-create. Example: ALTER sequence emp_sequenceINCREMENT BY 10 MAXVALUE 10000 CYCLE -- To NOCACHE from the beginning after 10000; initialization parameter affecting sequence: sequence_CACHE_ENTRIES = set the number of sequence that can be simultaneously cached. You can simply Drop sequence DROP sequence order_seq; End