Re: Custom Sequence Generator
Date: Wed, 15 Oct 2014 15:57:22 -0600
Message-ID: <543EEDC2.1020303_at_evdbt.com>
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-lReceived on Wed Oct 15 2014 - 23:57:22 CEST