Procedure documentationCreating Sequences Locate this document in the navigation structure

 

A sequence is a database object whose value the database system increases or decreases automatically with each access. The database system saves the values and administration information for sequences in the sequence cache.

Sequences are also called number generators.

Note Note

You cannot change the definition of a sequence.

End of the note.

Prerequisites

  • You are logged on to the database as a database system administrator, database user of type RESOURCE, or database user of type DBA.

  • You have the CREATEIN privilege for the schema in which you want to create the sequence.

    More information: SQL Reference Manual, Privileges: Overview

  • The database is in the ONLINE operational state.

Procedure

  1. In the explorer tree, select the user who is to be the owner of the sequence.

  2. Expand the folders of this user.

  3. In the context menu of the Sequence folder, choose   New   Sequence  .

  4. Enter the following data:

    Sequence: Properties

    Property

    Description (Link to SQL Reference Manual)

    Sequence Name

    Sequence name (sequence_name)

    Schema

    Schema name (schema_name)

    Start With

    First value of the sequence

    Increment By

    Difference between two successive values of the sequence

    A negative value generates a descending sequence.

    Default value: 1

    Minimum Value

    Minimum value

    Maximum Value

    Maximum value

    Values to Cache

    Number of values of the sequence that the system stores in the sequence cache

    Cycle

    Ascending sequences: after the system has reached the maximum value, it allocates the minimum value as next value.

    Descending sequences: after the system has reached the minimum value, it allocates the maximum value as next value.

  5. In the context menu of the editor window, choose Create Sequence.

    The logged-on user becomes the owner of the sequence.

More Information

SQL Reference Manual, CREATE SEQUENCE Statement (create_sequence_statement)

SQL Tutorial, Number Generators for Tables