CHAPTER -5
SEquEnCES
Let’s make coding fun!
SEQUENCES
A sequence is a set of integers 1, 2, 3, ... that are generated in order
on demand. Sequences are frequently used in databases because
many applications require each row in a table to contain a unique
value and sequences provide an easy way to generate them.
• Sequence is an Oracle Object that can generate numeric
values
• Sequence is an independent object and can be used with any
table that requires its output
SYNTAX
CREATE SEQUENCE <seq_name>
[INCREMENT BY <value>
START WITH<value>
MAXVALUE<val>/NOMAXVALUE
MINVALUE/NOMINVALUE
CYCLE/NOCYCLE
CACHE/NOCACHE
ORDER/NOORDER]’
EXAMPLE
CREATE SEQUENCE SEQ1
[INCREMENT BY 1
START WITH 1
MAXVALUE 9999999999
MINVALUE 1
CYCLE
ORDER];
COnCLuSIOn
In this chapter, we have covered all about Sequences and its
advantages in maintaining data in tables.