Updated on 2024-04-28 GMT+08:00

Sequence Management

Creating a Sequence

  1. In the Object Browser pane, right-click Sequences under the particular schema where you want to create the sequence and select Create Sequence. The Create New Sequence dialog box is displayed.

  2. Provide information to create a sequence:

    1. Enter a name in the Sequence Name field.

    Select the Case check box to retain the capitalization of the text entered in Sequence Name field. For example, if the entered sequence name is Employee, then the sequence name is created as "Employee".

    1. Enter the minimum value in the Minimum Value field.
    2. Enter the increase step value in the Increment By field.
    3. Enter maximum value in the Maximum Value field.

      The maximum and minimum value should be between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807.

    4. Enter the start value of the sequence in Start Value field.
    5. Enter the cache information in Cache field. The cache value denotes the number of sequences stored in the memory for quick access.
    6. Select the Cycle field to recycle sequences after the number of sequences reaches either the maximum or minimum value.

      The schema name auto-populates in the Schema field.

    7. Select the table from the Table drop-down list.
    8. Select the column from the Column drop-down list.

  3. Click Finish.

    The status bar displays the status of the completed operation.

    On the SQL Preview tab, you can view the SQL query automatically generated for the inputs provided.

Support for Sequence DDL

Data Studio allows you to display sequence DDL and export sequence DDL, including Show DDL, Export DDL, and Export DDL and Data.

In the Object Browser pane, right-click the selected table.

To check DDL statement, choose Show DDL.

To export DDL statements, choose Export DDL.

To export DDL and SELECT statements, choose Export DDL and Data

The procedure is shown in the following figure.

Only the sequence owner, system administrator, or a user who has the select permission on the sequence can perform the preceding operations.

Granting/Revoking a Privilege

  1. Right-click selected sequence and select Grant/Revoke. The Grant/Revoke dialog box is displayed.
  2. Select the objects to grant/revoke privilege from the Object Selection tab and click Next.
  3. Select the role from the Role drop-down list in the Privilege Selection tab. Select Grant/Revoke in the Privilege Selection tab.
  4. On the SQL Preview tab, you can check the automatically generated SQL query.
  5. Click Finish.

Dropping a Sequence

Right-click the selected sequence and select Drop Sequence. The Drop Sequence dialog box is displayed. Click Yes to drop the sequence.

Right-click the selected sequence and select Drop Sequence Cascade.