Friday, June 28, 2019

Oracle DB: Sequence


A sequence is a schema object that can generate unique sequential values.

Create a sequence:
CREATE SEQUENCE eseq
  INCREMENT BY 10;  


Check the current value of the sequence:
SELECT eseq.currval
    FROM DUAL;


Increase the value of the sequence and insert the value to a table
INSERT INTO mytable
    VALUES (eseq.nextval, ......);


Manually change the value of the sequence
ALTER SEQUENCE eseq INCREMENT BY 100;

No comments:

 
Get This <