A sequence generates a serial list of unique numbers for numeric columns of a database table. Database sequences are generally used to populate table primary keys.
Topics:
To create a sequence:
On the Workspace home page, click SQL Workshop and then Object Browser.
Object Browser appears.
Click Create.
From the list of object types, select Sequence.
Specify the following and click Next:
Sequence Name - Enter the name of the sequence.
Preserve Case - To have the final sequence name match the case entered in the Sequence Name field, click Preserve Case.
Start With - Enter the number of the first sequence. The first reference to sequence_name.nextval
returns this number.
Minimum Value - Enter the minimum value this sequence can return.
Maximum Value - Enter the maximum value this sequence can return.
Increment By - Each call to sequence_name.nextval
returns a value greater than the last, until the maximum value is reached. Enter the value used to increment to the next sequence number.
Cycle - Select this option to restart the sequence number to the minimum value when the maximum value is reached. This is not recommended if using the sequence for primary key creation.
Number to Cache - For faster access, specify how many sequence values are stored in memory.
Order - Specify ORDER to guarantee that sequence numbers are generated in order of request. This option is necessary if using Real Application Clusters (Oracle RAC).
A confirmation page appears, which displays the SQL used to create the sequence.
Click Create Sequence.
To browse a sequence:
On the Workspace home page, click SQL Workshop and then Object Browser.
Object Browser appears.
From the Object list, select Sequences.
From the Object Selection pane, select a sequence.
The Object Details view appears.
Click the tabs at the top of the page to view different reports about the sequence. Table 1-5 describes all available views.
Table 1-5 Available Views for Sequences
To drop a sequence:
On the Workspace home page, click SQL Workshop and then Object Browser.
Object Browser appears.
From the Object list, select Sequences.
From the Object Selection pane, select a sequence.
The Object Details view appears.
Click Drop.
To confirm, click Finish.