Home » SQL & PL/SQL » SQL & PL/SQL » function to convert alphanumeric character to number
function to convert alphanumeric character to number [message #400660] Wed, 29 April 2009 04:13 Go to next message
Fletcher
Messages: 9
Registered: April 2009
Junior Member
Hi, can any one help me in writing a function to convert alphanumeric character to number in pl/sql.
Re: function to convert alphanumeric character to number [message #400661 is a reply to message #400660] Wed, 29 April 2009 04:15 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
what sort of alphanumeric?
Re: function to convert alphanumeric character to number [message #400663 is a reply to message #400661] Wed, 29 April 2009 04:19 Go to previous messageGo to next message
Fletcher
Messages: 9
Registered: April 2009
Junior Member
I am trying to find some simple code that can get the numerical values from a string of letters and numbers. Say the string was 'a296g064jsfs2', how would I get the 56378914562
Re: function to convert alphanumeric character to number [message #400664 is a reply to message #400663] Wed, 29 April 2009 04:21 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
What is the relation between 'a296g064jsfs2' and 56378914562?

regards,
Delna
Re: function to convert alphanumeric character to number [message #400666 is a reply to message #400660] Wed, 29 April 2009 04:22 Go to previous messageGo to next message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
@Fletcher,

Depends on how you expect to convert 'alphabets' in your alphanumeric to numbers. Please post an example mentioning expected results.

Btw, please go through the posting guidelines mentioned in OraFAQ Forum Guide.

Regards,
Jo
Re: function to convert alphanumeric character to number [message #400668 is a reply to message #400663] Wed, 29 April 2009 04:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select 56378914562  from mytable where string='a296g064jsfs2';

Regards
Michel
Re: function to convert alphanumeric character to number [message #400670 is a reply to message #400664] Wed, 29 April 2009 04:30 Go to previous messageGo to next message
Fletcher
Messages: 9
Registered: April 2009
Junior Member
there is no relation between those two which I sent..thats just an example...actually if reference number is in alphanumeric then I need to convert it into number as per the requirement..for that i should write a function.Did anyone get me..If not I will again rephrase my question..
Re: function to convert alphanumeric character to number [message #400674 is a reply to message #400670] Wed, 29 April 2009 04:36 Go to previous messageGo to next message
cookiemonster
Messages: 12415
Registered: September 2008
Location: Rainy Manchester
Senior Member
Fletcher wrote on Wed, 29 April 2009 10:30
there is no relation between those two which I sent..thats just an example


Then it's a useless example.
To convert some data to some other data you need a rule to follow. If there's no relation between the alphanumeric and the number then you can't convert one to the other.
Quote:

...actually if reference number is in alphanumeric then I need to convert it into number as per the requirement



What requirement?
Re: function to convert alphanumeric character to number [message #400677 is a reply to message #400670] Wed, 29 April 2009 04:38 Go to previous message
trivendra
Messages: 208
Registered: October 2007
Location: Noida, India
Senior Member
You can use DBMS_RANDOM.RANDOM function.

SQL> SELECT ABS (DBMS_RANDOM.RANDOM) FROM DUAL

ABS(DBMS_RANDOM.RANDOM)
-----------------------
             1978502023

1 row selected.


Thanks
Trivendra
Previous Topic: Scheduling jobs
Next Topic: Check valid date
Goto Forum:
  


Current Time: Wed Dec 07 20:09:39 CST 2016

Total time taken to generate the page: 0.23695 seconds