Home > Software engineering >  Do Sequences automatically increment by 1?
Do Sequences automatically increment by 1?

Time:07-29

If I leave out the "INCREMENT BY" in a sequence, does it automatically just increment by one? I am realizing I checked in code to start a sequence and left out the "INCREMENT BY" statement. However, once I view the sequence in my schema, It shows the sequence is set to incrementing by 1. Just trying to figure out if I need to check out that code and make changes or is it fine.

CodePudding user response:

As documentation says:

INCREMENT BY
Specify the interval between sequence numbers. This integer value can be any positive or negative integer, but it cannot be 0. This value can have 28 or fewer digits for an ascending sequence and 27 or fewer digits for a descending sequence. The absolute of this value must be less than the difference of MAXVALUE and MINVALUE. If this value is negative, then the sequence descends. If the value is positive, then the sequence ascends. If you omit this clause, then the interval defaults to 1.

  • Related