reset sequence value

to reset your current sequence to value 1 follow the following steps:

we will assume the sequence name is SQ_CURR

1. Search for the current sequence value via the command:

SQL> select SQ_CURR.currval from dual;  

 2. Then change the sequence by adding the negative value of your previous result but subtract and addition one so for example if the value was 133389 you will increment it by -133388

SQL>  ALTER SEQUENCE SQ_CURR  INCREMENT by -133388; 

 

3. Then run the command that will reset the sequence:

SQL> SQ_CURR.NEXTVAL SELECT FROM DUAL; 

 

4. To restore the increment of the sequence:

SQL> ALTER SEQUENCE SQ_CURR  INCREMENT by 1;

 

hope this helps ….cheers!

😉

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s