What are sequences? Explain with syntax

What are sequences? Explain with syntax.

A field in oracle can be kept as auto incremented by using sequence. it can be used to create a number sequence.

Syntax:
CREATE SEQUENCE sequence_name
MINVALUE value
MAXVALUE value
START WITH value
INCREMENT BY value
CACHE value;

Example: employee_seq will cache up to 20 values for performance. Starts from one.
CREATE SEQUENCE employee_seq
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1
INCREMENT BY 1
CACHE 20;
Advantages of sequences
Sequence ensures that no other session or other call to nextval within the same session gets the same number from the sequence....
What are Schema Objects?
What are Schema Objects? - Schema objects are the logical database structure that represents database's data....
What is a sequence in oracle?
What is a sequence in oracle? - A Sequence is a user created database object. A sequence can be shared by multiple users to generate unique integers....
Post your comment