How to use new sequence when one is reached its maxvalue in PL SQL code
711952Jul 15 2009 — edited Jul 15 2009Hi,
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