Subscribe:

Tuesday, October 18, 2011

SEQUENCES

SEQUENCES
You create a sequence to generate a unique numbers.
Create sequences
You can create a sequence by using CREATE SEQUENCE statement
For example
Create sequence for the EMPNO column of the NEWEMP table begin the sequence at 100,and maximum value at 1000.
Type
CREATE SEQUENCE NEWEMP_EMPNO
INCREMENT BY 1
START WITH 100
MAXVALUE 1000;
The INCREMENT BY option specifies the gap between sequence numbers
START WITH option specifies the first number in the sequence.
MAXVALUE option specifies the maximum value the sequence can generate.
Other option not included in example
NOMAXVALUE: a default maximum value
NOMAINVALUE: specific the minimum sequence value.
CYCLE: cycle option specifies that the sequence continues to generate values.
CACHE: specifies the number of values the server reallocates in memory

No comments:

Post a Comment