Skip to Main Content

how to increase the sequence values via a Script

Satyam ReddyAug 11 2021

Team,
Per our project requirement , we are supposed to increase the sequence last number with value 500. Please suggest me how it can be done via a script with existing cache ,order,cycle values.
I normally take the create script from user_sequences table with the script shown below :

--Sequence creatioin script
SELECT 'CREATE SEQUENCE '
|| sequence_name
|| ' MINVALUE '
|| min_value
|| ' MAXVALUE '
|| max_value
|| ' INCREMENT BY '
|| increment_by
|| ' START WITH '
|| (last_number + 500)
|| ' NOCACHE '
|| ' NOCYCLE '
|| ';'
FROM user_sequences;

--Drop script:
select 'DROP SEQUENCE '||sequence_name||';' from USER_SEQUENCES;

Then drop all the sequence and recreate the sequences using the above script.
But i could not successfully load the cache, order and cycle values.
Appreciate Any recommendations

This post has been answered by Solomon Yakobson on Aug 11 2021
Jump to Answer
Comments
Post Details
Added on Aug 11 2021
14 comments
3,020 views