Skip to Main Content

Oracle Database Discussions

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!

Reuse unused Sequence value

531441Apr 11 2008 — edited Apr 11 2008
Good day all,

Can I have a way to reusing the unused values of a sequence.
let me make myself clear.

When I do an insert, for instance

insert into my_table (id, age) values (my_seq.nextval, 24);

and for a reason, the query fails. The currval of sequence was 2 but after the failed query, it becomes 3. So when I correct my query thus

insert into my_table (id, age) values (my_seq.nextval, 25);

what is inserted is (4, 25). At the end, I will have a id column that is not perfectly serial.

Now the question, how do I enforce my sequence structure to reuse the 3 (as in the last example)

Regards,
Michael
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2008
Added on Apr 11 2008
11 comments
2,552 views