Google+

Friday, October 8, 2010

A NOCYCLE sequence

 A NOCYCLE sequence

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

Sequence created.

A CYCLE sequence

 A CYCLE sequence

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;



Note:-Please comment and reply me.