View Single Post
  #2 (permalink)  
Old 09-22-2006, 05:46 AM
charlesryoung charlesryoung is offline
Junior Member
 
Join Date: Sep 2006
Posts: 3
charlesryoung is on a distinguished road
Default Oracle answer. Re: How to use BASE36 conversion in Oracle / SQL?

I assume you have a CHAR column in the database so you can hold the alpha characters. I don't know how to go to base 36 without a special function, but it is easy to go to hex. This would give you a maximum of 'fffff' which is decimal 1048575, over ten times the number of values you have now.

SELECT TO_CHAR(1048575,'xxxxx') FROM dual

TO_CHAR(1048575,'XXXXX')
------------------------
fffff

SELECT TO_NUMBER('fffff','xxxxx') FROM dual

TO_NUMBER('FFFFF','XXXXX')
------------------------------
1048575
Reply With Quote