Google+

Saturday, August 14, 2010

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.

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

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

SQL> select studentNumSeq.nextVal from dual;
select studentNumSeq.nextVal from dual
  *
ERROR at line 1:
ORA-08004: sequence STUDENTNUMSEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated


SQL> select studentNumSeq.nextVal from dual;
select studentNumSeq.nextVal from dual
*
ERROR at line 1:
ORA-08004: sequence STUDENTNUMSEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated


SQL>
SQL>
SQL> drop sequence studentNumSeq;

Sequence dropped.


Note:-Please comment and reply me.

1 comment:

  1. The site provides information about programming and oracle.Sushant is no doubt expert in his work. The info is always reliable and useful.

    ReplyDelete