Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Exhaused sequence

RE: Exhaused sequence

From: Knight, Jon <jknight_at_concordefs.com>
Date: Fri, 18 Feb 2005 11:02:25 -0600
Message-ID: <17ECCBDCF27C544583F2CAD928F953260221FB1E@memex1.corp.cefs.int>


  Thanks to everyone for the suggestions. And, Jared ... I guess I should give him a break, but I can only pay $1.99 per week.

  We discovered that the application code already checks for an existing record with the same sequence before inserts, so we've just recreated the sequence with a sufficiently low starting value to fill in the gaps.

Thanks,
Jon

 -----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Powell, Mark D

Sent:	Friday, February 18, 2005 7:50 AM
To:	Oracle-L_at_freelists.org
Subject:	RE: Exhaused sequence

We had the same problem and I solved it this way.

First create an IOT that consists only of a number(05) column.

Write a pl/sql script to start at the sequence starting value and fetch each stored row sequence key valuye by key until it hits the maximum value. Use the no_data_found exception to insert each missing sequence value into the IOT Write an anonymous transaction function that uses a select for update to select one row from the IOT and immediate delete where current of then pass the selected value back to the caller.

Replace the sequence name in the insert with the function name.

HTH -- Mark D Powell --

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Leonard, George Sent: Friday, February 18, 2005 1:13 AM
To: jknight_at_concordefs.com; Oracle-L_at_freelists.org Subject: RE: Exhaused sequence

Does it have to be type number,

If not consider using you function but return only 5 digits and prepend a 'a' to it,

Basically when done with the a you can move to be, this opens up another 26 X 99999=20

George
=20________________________________________________
George Leonard
Oracle Database Administrator
New Dawn Technologies @ Wesbank
E-mail:gleonard_at_wesbank.co.za
=20

You Have The Obligation to Inform One Honestly of the risk, And As a Person
You Are Committed to Educate Yourself to the Total Risk In Any Activity! Once Informed & Totally Aware of the Risk, Every Fool Has the Right to Kill or Injure Themselves as They See Fit!
=20

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Knight, Jon Sent: 17 February 2005 23:55 PM
To: 'Oracle-L_at_freelists.org'
Subject: Exhaused sequence

=20 We have a sequence that is about to reach it's maximum value (999999)=
.
Ordinarly, I would just expand the column and let it keep going, but it populates a business column. They don't care what the value is, as long as
it's unique and no longer than 6 digits. Of course, like many sequence populated columns, it's not consecutive.

=20 I'd like to go back and fill in those "gaps" while the business users=

decide what they want to do. So, I'm thinking: reset the sequence to zero &
create a function that calls nextval until it finds one that's available.
Besides a performance hit, are there any other gotchas I'm missing? Scalability?

=20 Has anyone done something similar before?

Thanks,
Jon Knight

--
http://www.freelists.org/webpage/oracle-l
_________________________________________________________________________=
__________________________


The views expressed in this email are, unless otherwise stated, those of =
the author and not those
of the FirstRand Banking Group an Authorised Financial Service Provider o=
r its management.
The information in this e-mail is confidential and is intended solely for=

=20the addressee.
Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribut= ion or any action taken or=20 omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrit= y of information and data=20 transmitted electronically and to preserve the confidentiality thereof, n= o liability or=20 responsibility whatsoever is accepted if information or data is, for what= ever reason, corrupted=20 or does not reach its intended destination.
=20 ________________________________
-- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-l
Received on Fri Feb 18 2005 - 12:05:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US