Database Reference
In-Depth Information
Figure 22.2
Create a Sequence
and Select the Next
Value.
We could, of course, create a sequence including START WITH and
INCREMENT BY parameters without relying on the defaults. We can even
set the INCREMENT BY value to a negative value and make the sequence
count backward
Let's drop the sequence we just created and demonstrate
this point. See the result of the following commands in Figure 22.3.
.
DROP SEQUENCE A_SEQUENCE;
CREATE SEQUENCE A_SEQUENCE INCREMENT BY -1;
SELECT A_SEQUENCE.NEXTVAL FROM DUAL;
SELECT A_SEQUENCE.NEXTVAL FROM DUAL;
SELECT A_SEQUENCE.NEXTVAL FROM DUAL;
Other parameters for sequence creation, so far not discussed but shown
in the syntax diagram in Figure 22.1, are as listed. All of these parameters
are switched off by default.
MINVALUE
. Sets a minimum value for a sequence. The default is
NOMINVALUE. This is used for sequences that decrease rather than
increase.
 
Search WWH ::




Custom Search