How to create sequence in PL/SQL
In this article I describe how to create the sequence in PL/SQL.
A sequence is a object in Oracle. Sequence is used to create autonumber field in oracle. The number generated are unique and can be act as primary key.
CREATE SEQUENCE sequence_name
START WITH value
INCREMENT BY value
CREATE SEQUENCE sequence_emp
START WITH 1
INCREMENT BY 1
This would create a sequence object called sequence_emp. The first sequence number will be 1 and each subsequent number would increment by 1. It will cache up to 20 values for performance.If MAXVALUE is not provided then its default is set up to 999999999999999999999999999.