2
Reply

What is CYCLE/NO CYCLE in a Sequence?

Gaurav Malviya

Gaurav Malviya

10y
1.1k
0
Reply

    When you create a sequence with CYCLE option, you are saying that when the sequence reaches its MAXVALUE, it will start over at the MINVALUE. This is not wise if using the sequence for primary key creation. When you create a sequence with NOCYCLE option, you are saying that when the sequence reaches its MAXVALUE, it will NOT start over at the MINVALUE. This option is safest if using the sequence for primary key creation. When the sequence reaches its MAXVALUE an oracle error is thrown.

    CYCLE specifies that the sequence continue to generate values after reaching either maximum or minimum value. After pan-ascending sequence reaches its maximum value, it generates its minimum value. After a descending sequence reaches its minimum, it generates its maximum. 
    NO CYCLE specifies that the sequence cannot generate more values after reaching its maximum or minimum value.