Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

reset oracle sequence

KarteekFeb 11 2014 — edited Mar 12 2014

Hi everyone,

using some ETL tool  i am migrating data into oracle database tables here i am not using oracle sequence. after migration i have to reset the sequence.

ex: table: employee,  sequence name : employee_id_seq

initially :

  create sequence employee_id_seq

          start with 1 increment by 1;

employee table data:

employee_id     ename

--------               ---------

1                    aa

5                    bb

6                    cc

to reset sequence i am dropping that sequence and recreating the sequence

ie.,

drop sequence employee_id_seq;

here max(employee_id) is 6 hence nextvalue is 7 .

create sequence employee_id_seq

          start with 7 increment by 1;

   select employee_id_seq.nextval from dual;

nextval:

--------

7

instead of drop and recreate sequence any other method is there to reset the sequence.so, that i will create a dynamic script that will reset all sequences.

please advise on this.

Thanks,

karteek

This post has been answered by Karteek on Mar 12 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2014
Added on Feb 11 2014
12 comments
5,617 views