get numbers out of a char [message #204894] |
Wed, 22 November 2006 09:32 |
steffeli
Messages: 112 Registered: July 2006
|
Senior Member |
|
|
Hello,
How can I get only the numbers out of a char? Example:
Param1 -> Result (new parameter)
LX4587 -> 4587
U74AAA -> 74
78U8 -> 788
Thanks
Stefan
|
|
|
Re: get numbers out of a char [message #204900 is a reply to message #204894] |
Wed, 22 November 2006 09:42 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Here's the paltry low tech solution.select replace(translate(upper('AS657A3'),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',' ')
,' ',null)
from dual
Lets see who gets the Regex solution in first.
|
|
|
|
|
Re: get numbers out of a char [message #204908 is a reply to message #204904] |
Wed, 22 November 2006 09:58 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Would you like me to come over there and code it for you?
select to_number(replace(translate(upper('AS657A3'),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',' ')
,' ',null))
from dual
Actually - you didn't ask that originally. You asked how to get the numbers out of a string.
[Updated on: Wed, 22 November 2006 09:59] Report message to a moderator
|
|
|