A current ID field used in my Oracle database is a 10 digit numeric. I have a business requirement for this ID to be 9 characters rather than 10. I want to consider converting this ID to alphanumeric so that I can map the existing 10 digit IDs 1-to-1 to the new alphanumeric values which are 9 characters long.
Is there an existing feature in Oracle (or even outside Oracle) that would do this i.e. convert an all numeric value to alphanumeric but also “shrink” it from X characters to X-1 and not have any mapping “collisions”?
I should also add that once I do this conversion, I also want to be able to generate new ids that follow this new format.
Given the amount of “room” that switching to alpha-numeric would give me, all current 10 digit numbers would fit into the space of 5 alphanumeric characters. So I am thinking I simply preprend 0000 to the front of the 5 alphanumeric characters. So lets say that my “highest” mapped ID value is “ZZZZ”, then I would plop “0000” in front making it “0000ZZZZZ”. The next number ID I generate would be “0001ZZZZZ”.
It looks like all I might need to do is base36 encode my IDs: en.wikipedia.org/wiki/Base_36