Database Reference
In-Depth Information
Figure 22.4
ALTER
SEQUENCE
Syntax.
is absolutely imperative to maintain exact sequence counters, then
the default of CACHE 20 is best left as it is.
ORDER
. Ordering simply guarantees that sequence numbers are cre-
ated in precise sequential order. In other words, with the
NOORDER option, sequence numbers can possibly be generated
out of sequence sometimes, when there is excessive concurrent activ-
ity on the sequence.
22.1.2
Changing and Dropping Sequences
When changing a sequence, the only parameter not changeable is the
START WITH parameter. It is pointless to start an already started sequence.
Therefore, resetting the sequence to an initial value requires either recycling
(CYCLE) or dropping and re-creating the sequence. The syntax for chang-
ing a sequence is as shown in the syntax diagram in Figure 22.4.
Let's change the sequence A_SEQUENCE we created in the previous
section, currently a descending sequence, into an ascending sequence. The
result of the following commands is shown in Figure 22.5.
ALTER SEQUENCE A_SEQUENCE INCREMENT BY 1;
SELECT A_SEQUENCE.NEXTVAL FROM DUAL;
SELECT A_SEQUENCE.NEXTVAL FROM DUAL;
We can drop the sequence A_SEQUENCE to clean up.
DROP SEQUENCE A_SEQUENCE;
 
Search WWH ::




Custom Search