Home » SQL & PL/SQL » SQL & PL/SQL » Covert unique string to unique number (Oracle 10)
Covert unique string to unique number [message #640119] Wed, 22 July 2015 10:57 Go to next message
brown_zzz
Messages: 39
Registered: August 2012
Location: United Kingdom
Member
In ORACLE I need a way of converting a unique string to a unique number but don't want the length of the number in digits to be longer than the string. Does anyone know how please?
Re: Covert unique string to unique number [message #640120 is a reply to message #640119] Wed, 22 July 2015 10:59 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Please post a test case.
Re: Covert unique string to unique number [message #640122 is a reply to message #640119] Wed, 22 July 2015 11:09 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

How is this related to Oracle?
Is this not pure maths?

And with these ones I can tell you this is not possible (assuming with "length of a number" you mean "number of digits").

Re: Covert unique string to unique number [message #640123 is a reply to message #640122] Wed, 22 July 2015 11:17 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
OP,
What is solution for the 26 strings below?

a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

Re: Covert unique string to unique number [message #640125 is a reply to message #640119] Wed, 22 July 2015 12:42 Go to previous message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
I think that this is impossible. Assuming that you are using a reasonably normal character set, your string is (in effect) a number in base 256, but your number will be in base 10. So there simply aren't enough unique numbers to cover all possible unique strings.
Previous Topic: Oracle trigger name and after end of the trigger name if mismatch, trigger is compiled and no error.
Next Topic: Like in Order by
Goto Forum:
  


Current Time: Wed Apr 24 23:04:07 CDT 2024