A decrement sequence : Sequence Increment « Sequence « Oracle PL / SQL






A decrement sequence

 

SQL>
SQL> -- A decrement sequence
SQL>
SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2    INCREMENT BY -1
  3    START WITH 50000
  4    MAXVALUE   99999
  5    MINVALUE   0
  6    NOCACHE
  7    NOCYCLE;

Sequence created.

SQL>
SQL> select studentNumSeq.nextVal from dual;

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

SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
     49999

SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
     49998

SQL> select studentNumSeq.nextVal from dual;

   NEXTVAL
----------
     49997

SQL>
SQL>
SQL> drop sequence studentNumSeq;

Sequence dropped.

SQL>
SQL>
SQL>

           
         
  








Related examples in the same category

1.Get next value from sequence