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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to generate random unique Alphanumeric six digit number from sequence value

User_V6AO3Jan 28 2022

Hi All,
I have a requirement to generate random unique Alphanumeric six digit number from sequence value.Could you please help..
E.g sequence value = 65918362 (which will be generating unique value increment by 1)
but from that seq i have to generate for first 4 digit,it should be unique character value(no special charcater) and other 4 digit will remain same like sequence value.
---------------------
I have used below func like
Select CHR(TO_NUMBER(SUBSTR(65918362, 1, 2))) ||CHR(TO_NUMBER(SUBSTR(65918362, 3, 2)))|| SUBSTR(65918362, 5) from dual;
Output: A[8362---Which is not correct ..because upto 90 it will return AZ8362.
So I need the output like AB8362,BBthen4digit no(i.e every time it should be unique).

Please help me..

Thanks,
Raghu

Comments
Post Details
Added on Jan 28 2022
22 comments
2,442 views