Evaluate the following CREATE SEQUENCE statement:
CREATE SEQUENCE seq1
START WITH 100
INCREMENT BY 10
MAXVALUE 200
CYCLE
NOCACHE;
The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following SQL statement:
SELECT seq1.nextval FROM dual;
What is displayed by the SELECT statement?
A. 100
B. an error
C. 10
D. 1
A
D
STARTS WITH used for the very first time. When sequence restart it will start with MINVALUE. Since MINVALUE is not define here it will use default MINVALUE which is 1.
SQL> SELECT seq1.nextval FROM dual;
NEXTVAL
———-
200
SQL>
SQL> SELECT seq1.nextval FROM dual;
NEXTVAL
———-
1
SQL>
D
D
A