Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Mixed Alphanumeric Unique IDs???
Connor McDonald <connor_mcdonald_at_yahoo.com> wrote in message news:<3EB09625.3BF1_at_yahoo.com>...
> DTS wrote:
> >
> > Hi group,
> > I'm wondering what the best way is to construct unique ID's for
> > primary keys and such. I would like to create unique keys that use a
> > combination of letters and numbers. Oracle sequences only generate
> > numbers - should I consider some form of hashing algorithm, such as
> > MD5? In general, what are the best practices for primary key usage in
> > Oracle???
> >
> > THANKS!
> > DTS
>
> A quick and easy way is to convert the number to hex, then you will
> "pseudo-alphanumeric"
>
> hth
> connor
Connor, interesting trick. Another method would be to concatenate the sequence value to a leading alpha character so as to allow easy visual identification by type from each other for customer numbers, vendor numbers, work order numbers, and sales order numbers for example. This can be done in before triggers very nicely.
![]() |
![]() |