Updating sequence in oracle

Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community.

Founding member, and vice president of Turkish Oracle User Group (TROUG).

Oracle does not let you change the value of a sequence.

If you need to change its value, you should re-create the sequence.

If you ever do data refreshes from production to development or test environments you may run into an issue where your sequences are not up to date.

month) new or a heavy import has been done and the sequence should now be set to the max-value 1 of the rows inserted to the table.

In Oracle it is possible to alter an existing Oracle sequence.

A sequence is an object in Oracle that is used to generate a number sequence.

This can be useful when you need to create a unique number to act as a primary key. The first sequence number that it would use is 1 and each subsequent number would increment by 1 (ie: 2,3,4,...}. If you omit the MAXVALUE option, your sequence will automatically default to: Now that you've created a sequence object to simulate an autonumber field, we'll cover how to retrieve a value from this sequence object.

Search for updating sequence in oracle:

updating sequence in oracle-13

CREATE SEQUENCE gokhan.sample_seq START WITH 1000; SELECT last_number FROM user_sequences WHERE sequence_name = 'SAMPLE_SEQ'; LAST_NUMBER ----------- 1000 ALTER SEQUENCE gokhan.sample_seq INCREMENT BY -500; SELECT gokhan.sample_seq.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating sequence in oracle”