Previous |
Next |
To create a sequence, use either the SQL Developer tool Create Sequence or the DDL statement CREATE
SEQUENCE
.
This tutorial shows how to use the Create Database Sequence tool to create a sequence to use to generate primary keys for the EVALUATIONS
table (created in "Creating Tables with the CREATE TABLE Statement"). The equivalent DDL statement is:
CREATE SEQUENCE EVALUATIONS_SEQ INCREMENT BY 1 START WITH 1 ORDER;
This sequence is part of the sample application that the tutorials and examples in this document show how to develop and deploy.
To create EVALUATIONS_SEQ using the Create Database Sequence tool:
On the Connections tab, expand hr_conn.
Under the hr_conn
icon, a list of schema object types appears.
Right-click Sequences.
A list of choices appears.
Click New Sequence.
The Create Database Sequence window opens. The field Schema has the value HR
, and the field Name has the default value, SEQUENCE1
.
In the Name field, type EVALUATIONS_SEQ
over the default value.
Click the tab Properties.
The Properties pane appears.
In the field Increment, type 1.
In the field Start with, type 1.
Deselect the check box Cycle.
Select the check box Order.
Click OK.
The sequence EVALUATIONS_SEQ
is created. To see it, expand Sequences in the navigation frame.