Your browser does not support JavaScript. This help page requires JavaScript to render correctly. Tutorial: Creating a Sequence
Skip Headers
Previous
Previous
 
Next
Next

Tutorial: Creating a Sequence

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:

  1. On the Connections tab, expand hr_conn.

    Under the hr_conn icon, a list of schema object types appears.

  2. Right-click Sequences.

    A list of choices appears.

  3. 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.

  4. In the Name field, type EVALUATIONS_SEQ over the default value.

  5. Click the tab Properties.

    The Properties pane appears.

  6. In the field Increment, type 1.

  7. In the field Start with, type 1.

  8. Deselect the check box Cycle.

  9. Select the check box Order.

  10. Click OK.

    The sequence EVALUATIONS_SEQ is created. To see it, expand Sequences in the navigation frame.

Related Topics

Oracle Database SQL Developer User's Guide

Oracle Database SQL Language Reference

Tutorial: Creating a Trigger that Generates a Primary Key for a Row Before It Is Inserted

Creating and Managing Sequences