Using a Sequence : all_sequences « System Tables Data Dictionary « Oracle PL/SQL Tutorial






  1. A sequence generates a series of numbers.
  2. A sequence contains two pseudo columns named currval and nextval.
  3. Before retrieving the current value you must initialize a sequence by retrieving the next value.
  4. When you select test_seq.nextval the sequence is initialized to 1.
SQL> CREATE SEQUENCE test_seq;

Sequence created.

SQL>
SQL> SELECT test_seq.nextval FROM dual;

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

SQL>
SQL> drop sequence test_seq
  2  /

Sequence dropped.








30.12.all_sequences
30.12.1.Get information on all the sequences you have access to using all_sequences.
30.12.2.Using a Sequence