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.

How to use new sequence when one is reached its maxvalue in PL SQL code

711952Jul 15 2009 — edited Jul 15 2009
Hi,

Currently, I am populating a unique product serial number in a table column using a sequence call to generate new number. For different products, I have different sequences and in my PL SQL code usiing IF..Else block I populate serial number for different products. For one most selling product sequence, we are reaching a Max value in production in a month and to make sure that application will continue to work fine for various end users without getting any error on their screens, I want my code to switch to new sequence automatically. I just need to add another if condition but my problem is how to find accurately when max value is reached for old sequence.

As call to old sequence can happen in different sessions there could be inconsistency and can end up at error. My new sequence value has to start with AV1000. Please suggest.

My old sequence look like this :
SEQUENCE Prd
INCREMENT BY 1
START WITH AS1000
MAXVALUE AS9999
MINVALUE AS1000
CYCLE NOCYCLE
CACHE 2
Order Yes;

Edited by: user11695088 on Jul 15, 2009 12:14 AM
This post has been answered by RadhakrishnaSarma on Jul 15 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2009
Added on Jul 15 2009
3 comments
1,945 views