Home » Developer & Programmer » Forms » How to remove characters
How to remove characters [message #81864] Thu, 27 March 2003 10:58 Go to next message
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 Go to previous messageGo to next message
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 #81875 is a reply to message #81870] Fri, 28 March 2003 04:28 Go to previous messageGo to next message
Vaibhav
Messages: 13
Registered: April 2001
Junior Member
Works Great!!! Thanks a lot geetha
Re: How to remove characters [message #81881 is a reply to message #81864] Fri, 28 March 2003 23:29 Go to previous message
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;
Previous Topic: Oracle Reports on linux slowly startup
Next Topic: FRM-40737 Illegal restricted procedure EXIT-FORM in ON-LOGON or in PRE-FORM
Goto Forum:
  


Current Time: Thu Apr 25 07:31:24 CDT 2024