CREATE SEQUENCE test_seq; : Create Sequence « Sequences « Oracle PL/SQL Tutorial






Sequence created.

SQL>
SQL> SELECT test_seq.nextval FROM dual;

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

SQL> SELECT test_seq.currval FROM dual;

   CURRVAL
----------
         1

SQL> SELECT test_seq.nextval FROM dual;

   NEXTVAL
----------
         2

SQL>
SQL> ALTER SEQUENCE test_seq
  2  INCREMENT BY 2;

Sequence altered.

SQL>
SQL> SELECT test_seq.nextval FROM dual;

   NEXTVAL
----------
         4

SQL> SELECT test_seq.currval FROM dual;

   CURRVAL
----------
         4

SQL> SELECT test_seq.nextval FROM dual;

   NEXTVAL
----------
         6

SQL>
SQL>
SQL> drop sequence my_seq;

SQL>








5.1.Create Sequence
5.1.1.Sequences
5.1.2.Create the simplest sequence
5.1.3.Creating a sequence and then get the next value
5.1.4.Test sequence step
5.1.5.CREATE SEQUENCE test_seq;
5.1.6.Using a sequence to populate a table's column
5.1.7.create sequence deptno_seq start with 50 increment by 10
5.1.8.Create a sequence starting with '100000000 order'
5.1.9.Create a sequence
5.1.10.CREATE SEQUENCE myTableIDSeq INCREMENT BY 1 START WITH 1000;
5.1.11.Create a sequence starting with 1000
5.1.12.create sequence emps_seq start with 501 increment by 10