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!

Random number generation

701166May 13 2009 — edited May 13 2009
Hello All,
We have a requirement like we have to generate unique random numbers with alphanumeric strings whose length is 7.The output should be somewhat like AB1-BC4T.The following are the validations needs to be checked.
1.generate 3 character alphanumeric strings keeping not more that 2 alphabets together.
2.generate 4 character alphanumeric strings keeping not more that 2 alphabets together.
3.Concatenate both the strings with a ‘-‘.

We thought of using the dbms_random.string to generate the random numbers and then do these validations.
How do we ensure that the 7 digit number is always unique (say till 1 million records)? Is there any way other than storing all generated numbers in some temp table and validating from there?

Any other pointers will be highly appreciated.

Regards,
Sumi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2009
Added on May 13 2009
7 comments
563 views