CREATE SEQUENCE StudentNumSeq
 INCREMENT BY 500
 START WITH 500
 MAXVALUE   1100
 NO CYCLE;

/*r500*/SELECT next value for StudentNumSeq FROM DUAL;
/*r1000*/SELECT next value for StudentNumSeq FROM DUAL;
/*e*/SELECT next value for StudentNumSeq FROM DUAL;

DROP SEQUENCE StudentNumSeq;

CREATE SEQUENCE StudentNumSeq
 INCREMENT BY 500
 START WITH 500
 MAXVALUE   1100
 MINVALUE   0
 NO CYCLE;

ALTER SEQUENCE StudentNumSeq RENAME TO StdSeq;
ALTER SEQUENCE StdSeq CYCLE;
ALTER SEQUENCE StdSeq RESTART;

/*r500*/SELECT next value for StdSeq FROM DUAL;
/*r1000*/SELECT next value for StdSeq FROM DUAL;
/*r0*/SELECT next value for StdSeq FROM DUAL;

ALTER SEQUENCE StdSeq NO MAXVALUE;

/*r500*/SELECT next value for StdSeq FROM DUAL;
/*r1000*/SELECT next value for StdSeq FROM DUAL;
/*r1500*/SELECT next value for StdSeq FROM DUAL;

ALTER SEQUENCE StdSeq INCREMENT BY -500;

/*r2000*/SELECT next value for StdSeq FROM DUAL;
/*r1500*/SELECT next value for StdSeq FROM DUAL;
/*r1000*/SELECT next value for StdSeq FROM DUAL;
/*r500*/SELECT next value for StdSeq FROM DUAL;

ALTER SEQUENCE StdSeq MAXVALUE 1500;

/*r0*/SELECT next value for StdSeq FROM DUAL;
/*r1500*/SELECT next value for StdSeq FROM DUAL;
