Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / System Tables Data Dictionary
 

Using a Sequence

A sequence generates a series of numbers. A sequence contains two pseudo columns named currval and nextval. Before retrieving the current value you must initialize a sequence by retrieving the next value. 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.