RE: Custom Sequence Generator

From: Ebadi, Abdul <Abdul.Ebadi_at_Level3.com>
Date: Thu, 16 Oct 2014 03:27:57 +0000
Message-ID: <2B2D8E96233804478FA849965DF3B2C1B8FCAE0D_at_USIDCWVEMBX09.corp.global.level3.com>



Tim/everyone else,

Thank you all for your quick and very helpful responses! We’ll sort through our options you have mentioned and choose one.

Sorry for the confusion on the original question.

Thanks,
Abdul

From: Tim Gorman [mailto:tim_at_evdbt.com] Sent: Wednesday, October 15, 2014 3:57 PM To: oracle-l_at_freelists.org; Ebadi, Abdul Subject: Re: Custom Sequence Generator

Abdul,

It sounds like you feel you might run out of numbers generated using base-10 within 10-12 digits, right?

To "cram" more possible values into 12 digits, use a higher base, such as base16 (i.e. hexadecimal) or base64 (i.e. as used in Oracle ROWIDs, which use the ranges of "[A-Z][a-z][0-9]+-" as the values for each digit)?

Twelve digits in base10 gets you to 1 billion (i.e. 1,000,000,000,000) minus one. That's probably too small.

Twelve digits in base16 gets you to about 281.4 trillion or so. That might be a little better for you, and it would be relatively easy to code. Using one value at a rate of 1/sec should take about 8.9 million years to exhaust, which also means that using one value each micro-second should still take about 8.9 years to exhaust?

So, if that's not good enough, then twelve digits in base64 probably gets you to where you sound like you want to be. :-) Problem is, you'd almost certainly have to code your own base10-to-base64 and base64-to-base10 converters.

Hope this helps...

-Tim

On 10/15/14 14:28, Ebadi, Abdul wrote:
Hi,

We have a need to generate a 10 or 12 digit unique key. Anyone have a quick function for this? For example: 435A24C1.

We don’t want to use Oracle’s sequences as we are afraid we will run out of unique ones. We need billions of these keys.

Thanks,
Abdul

--

http://www.freelists.org/webpage/oracle-l Received on Thu Oct 16 2014 - 05:27:57 CEST

Original text of this message