SQL Recipes (Beta II)
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
  #1 (permalink)  
Old 06-12-2006, 11:25 PM
moneysa moneysa is offline
Junior Member
 
Join Date: Jun 2006
Posts: 1
moneysa is on a distinguished road
Default Oracle dialect question:

How to use BASE36 conversion in Oracle / SQL?


I would like to know how to use BASE36 conversion in Oracle.
Have a problem with number system (only 5 digits) running now out of numbers and would like to use alpha characters in the numbering system ie
99999 next number A0000
Thank You
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:56 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2007 SQL Recipes

1 2 3 4 5 6 7