Turn https://www.cnblogs.com/21-forever/p/11265924.html
sequence:
1, Oracle does not support self-growth;
①, is a unique sequence, sequence numbers object generation;
②, the sequence may be ascending, descending or may be;
③, create: the Create Sequence (The first three have to write)
2, access sequence:
nextval: returns the next value of the sequence;
currval: Returns the current value of the sequence
- - create a sequence (corresponding to a counter, regardless of the table)
Create seq_student Sequence Start with . 1 INCREMENT by . 1 ; Create Table STU (ssid int Primary Key , sname VARCHAR ( 10 )) - to a sequence of values assigned ssid INSERT INTO STU values (seq_student.nextval, ' John Doe '); - at a value -nextval INSERT INTO STU values (seq_student.nextval, ' John Doe ' ); SELECT * from STU SELECT seq_student.currval from Dual;- currval current value
note:
Sequence table without any relationship! ! !
3, when an exception needs to be modified, and deleted sequence appears Tips: Delete rebuild!