Sequence Designer

The Sequence Designer lets you create or modify sequences. This section covers the following topics:

Creating Sequences in Oracle Developer Tools

Use the Sequence Designer to create or modify sequences. To create a sequence in your own schema, you must have the CREATE SEQUENCE system privilege. To create a sequence in another user's schema, you must have the CREATE ANY SEQUENCE system privilege.

Starting the Sequence Designer

Start the Sequence Designer by using one of the following methods:

  • If you are creating a new sequence, in Server Explorer, right-click the Sequences node and from the menu, select New Sequence.

  • If you are modifying an existing sequence, in Server Explorer, double-click the node that represents that sequence, or right-click the node and select Edit.

The Sequence Designer appears similar to the following:

Using the Sequence Designer

The Sequence Designer has the following controls:

Control Description

Schema name

Select from the list of available schemas in which to create the sequence.

Sequence name

Enter a name for the sequence.

Type

Select either of the following:

  • Ascending: Increments each generated sequence value by the interval value.

  • Descending: Decrements each generated sequence value by the interval value.

Values

Specifies the range of values to use for the sequence.

  • Minimum: Minimum value the sequence can generate. This integer value can have 28 or fewer digits. The minimum value must be less than or equal to the initial value and less than the maximum value.

  • Maximum: Maximum value of the sequence. This integer value can have 28 or fewer digits. The maximum value must be equal to or greater than the initial value and greater than the minimum value.

  • Interval: Incremented value between sequences. Enter any positive or negative integer except 0, up to 28 digits. This value can have 28 or fewer digits. The absolute value of Interval must be less than the difference of the maximum and minimum values.

    If this value is negative, the sequence descends. If the value is positive, the sequence ascends. If you omit this setting, the interval defaults to 1.

  • Initial value: The first sequence number to be generated. Use this setting to start an ascending sequence at a value greater than its minimum or to start a descending sequence at a value less than its maximum.

    For ascending sequences, the default value is the minimum value of the sequence. For descending sequences, the default value is the maximum value of the sequence. This integer value can have 28 or fewer digits.

Options

Select from the following settings:

  • Allow cycle: Lets the sequence continue to generate values after reaching either its maximum or minimum value. After an ascending sequence reaches its maximum value, the sequence generates its minimum value.

    After a descending sequence reaches its minimum, it generates its maximum value. By default, a sequence cannot generate more values after reaching its maximum or minimum value.

  • Order values: Generates the sequence numbers in order of request. This clause is useful if you are using the sequence numbers as timestamps. Guaranteeing order is usually not important for sequences used to generate primary keys.

    This setting is necessary only to guarantee ordered generation if you are using Oracle Database with Real Application Clusters. If you are using exclusive mode, sequence numbers are always generated in order.

  • Cache: Specifies how many values of the sequence the database pre-allocates and keeps in memory for faster access. This integer value can have 28 or fewer digits. The minimum value for this parameter is 2.

    If you do not select this setting, Oracle Database caches 20 sequence numbers by default.

Preview SQL

Displays the CREATE SEQUENCE SQL command code in a pop-up dialog box and in the output window. Read-only.

Save

Commits the sequence to the database. Alternatively, you can click the Save button in the Visual Studio .NET toolbar or select Save from the File menu.

See Also

Sequences Node