All Products
Search
Document Center

:Create a sequence

Last Updated:Jan 03, 2023

Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click Sequence in the left-side navigation pane to get a list of sequences. To create a sequence, click + in the upper-right corner of the sequence list or choose Create > Sequence in the top navigation bar. Perform the following two steps to create a sequence:

  1. Set Basic Info: You need to specify Sequence Name and User. The User parameter is automatically specified based on the current account.

  2. Set columns. This step is optional. You need to specify the following parameters to set columns:

    Parameter

    Description

    From

    Specifies the initial value of the sequence, which must not be less than the value of Minimum Value.

    Increment

    Specifies the step size for the auto-increment of sequence values. The value can be a negative number.

    Minimum Value

    Specifies the minimum value that can be obtained by the sequence. The minimum value supported by the database is -1026.

    Maximum Value

    Specifies the maximum value that can be obtained by the sequence. The maximum value supported by the database is 1027.

    Cache Settings

    Specifies the cache size for the sequence. A proper cache size can improve the performance in obtaining sequence values. You can also set the value to No Cache.

    Whether to Sort

    Specifies whether the sequence obtains values in an ordered manner. The performance of the sequence in obtaining values in an ordered manner is inferior to that in an unordered manner.

    Cyclic or Not

    Specifies whether to start from the minimum value again when the sequence value reaches the maximum value.

  3. Click Next: Verify SQL Statement to go to the Create Sequence page.

    Database Object  / / /> Create Sequence > Confirm
  4. An SQL script is pre-generated based on the information you specified. After the SQL script is verified, click Create in the upper-right corner to run the script and generate a sequence.