How to remove characters [message #81864] |
Thu, 27 March 2003 10:58 |
Vaibhav
Messages: 13 Registered: April 2001
|
Junior Member |
|
|
Hi ,
I have field which is alpha numeric and I want to get rid of caharcters in that..
e.g. this field has following values:
126private
3427go
789897hit
and i want only 126, 3427, 789897 from it.
HOw can i do it??? any ideas??
|
|
|
Re: How to remove characters [message #81870 is a reply to message #81864] |
Thu, 27 March 2003 21:40 |
geetha
Messages: 20 Registered: August 2000
|
Junior Member |
|
|
Vaibhav,
U can solve it as mentioned below. I have tested it out and it works fine. Good Luck!
Thanks
Geetha
declare
field_with_char varchar2(15) := 'abCD1022erZ12';
field_without_char varchar2(15) := null;
begin
for i in 1..15 loop
if lower(substr(field_with_char,i,1)) not between 'a' and 'z' then
field_without_char := field_without_char||substr(field_with_char,i,1);
end if;
end loop;
dbms_output.put_line('after trimming chars field is:'||field_without_char);
end;
|
|
|
|
Re: How to remove characters [message #81881 is a reply to message #81864] |
Fri, 28 March 2003 23:29 |
Serge
Messages: 5 Registered: May 2002
|
Junior Member |
|
|
Universal method.
Work in SQL.
But remove only english chars.
SELECT TRANSLATE(UPPER('dsauif32EFWEFguig4WEEWG321ugi321ugiUYFD'),'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ','0123456789') FROM dual;
|
|
|