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!

remove specific spaces in a string in pl/sql

846465Mar 10 2011 — edited Mar 10 2011
Hello,

I need to remove only the specific spaces in a string for eg only spaces before and after '&' as shown below.
We should keep the spaces at other parts of the string, however the white space befire and after & should be removed.

'state=new york & name=ab aff & ref=new' -> 'state=new york+name=ab aff+ref=new'

How we can do in pl/sql in a efficient way? can REGEXP_REPLACE be used? I amnot sure how it can be done in most efficient way.
I can probably use the substr and instr.

Thanks a lot
TJ
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2011
Added on Mar 10 2011
8 comments
3,673 views