Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to generate alpha-numeric sequence in Oracle?

Re: How to generate alpha-numeric sequence in Oracle?

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Tue, 31 Oct 2006 20:33:13 GMT
Message-ID: <J80p3D.KIE@igsrsparc2.er.usgs.gov>


kranilk_at_gmail.com wrote:
> Hello All,
>
> After searching the web unsuccessfully for what I am looking for, I
> have come here.
> I need to generate a 6 digit alpha-numeric sequence of values that
> looks like the following.
> 00001A
> 00001B
> :
> 00001Z
> 00002A
> 00002B
> :
>
> Do any of you know how to generate the above using sequence in Oracle?
> Any information and/or pointers will be very helpful to me. And, of
> course, any sample code would be greatly appreciated. I mainly work in
> Java. We are using Oracle 9i.
>
> Thanks in advance for all the help.
>

You could do this programmatically by creating your own function. An Oracle sequence will only generate integer values. However, you can extend this. Think of hexadecimal....with values from 0 to 9 and A to F. If you were given a decimal integer, you would easily write a routine to convert it to hex. Just do the same thing, but the values are from 0 to 9 and A to Z. Store your code in a function. Have that code get the sequence's next value and the do the conversion.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Tue Oct 31 2006 - 14:33:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US