Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using regexp_replace to replace control chars and ;

tinku981Dec 11 2012 — edited Dec 11 2012
Hello,

I wanted to replace control characters by SPACE and semi colon (;) by comma (,) that are in same column. Could you please help me same?

create table t (char_value varchar2(30));
insert into t (char_value) values ('a' || chr(9) || 'b' || chr(10) || 'c' || chr(13) || 'd' || ';');
select * from t;

Following is desired output which can be achieved by translate
a b c d,
select translate(char_value,chr(9)||chr(10)||chr(13)||';',' ,') from t;

But can we do same by using regular expression. I am able to just replace the control character but not able to use same for replace ;
select regexp_replace(char_value, '[[:cntrl:]]', ' ') from t;

Thanks in advance,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2013
Added on Dec 11 2012
4 comments
2,969 views