Set sequence max value : Sequence Value « Sequence « Oracle PL / SQL






Set sequence max value

 


SQL>
SQL> -- A CYCLE sequence
SQL>
SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2    INCREMENT BY 50000
  3    START WITH 50000
  4    MAXVALUE   99999
  5    NOCACHE
  6    CYCLE;

Sequence created.

SQL>
SQL>
SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
     50000

SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
         1

SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
     50001

SQL>
SQL>
SQL> drop sequence studentNumSeq;

Sequence dropped.

SQL>
SQL>
           
         
  








Related examples in the same category

1.Use sequence in insert command
2.Sequence current value and next value
3.Get Sequence next value
4.Sequence max value: 999999999999999999999999999
5.Use Sequence in a procedure
6.If new value is null use the value from a sequence
7.Automatically including unique sequence numbers during an INSERT.
8.Random value based on sequence