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!

Trimming white spaces in the string.

vissuNov 18 2010 — edited Nov 19 2010
Hi all,

I wanna know how to trim the white spaces in the entire line while reading the file. For suppose, the below line has,

'10/7/2010,,DRI DEV,,07A0002EE                           ,BIOS 0.75FAWARM 2.003     ,DRI,,215461 D ,2.0.5-O     ,,,,manson,Gear IT,07A0002EE                           '
I am using regexp_replace function. but I'm not able to use in the proper way. See the below query:

select trim(regexp_replace('10/7/2010,,DRI DEV,,07A0002EE ,BIOS 0.75FAWARM 2.003 ,DRI,,215461 D ,2.0.5-O ,,,,manson,Gear IT,07A0002EE ','[[:space:]]')) text
from dual;

o/p: 10/7/2010,,DRIDEV,,07A0002EE,BIOS0.75FAWARM2.003,DRI,,215461D,2.0.5-O,,,,manson,GearIT,07A0002EE. Here, space also replacing including white spaces. I don't want replace the space only remaing whitespaces need like expected o/p.

Expected O/p: 10/7/2010,,DRI DEV,,07A0002EE,BIOS0.75FAWARM2.003,DRI,,215461D,2.0.5-O,,,,manson,Gear IT,07A0002EE

Oracle version:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production

Please help me.



Thanks in advance!!

Regards,
Vissu...
This post has been answered by Sayan Malakshinov. on Nov 19 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2010
Added on Nov 18 2010
6 comments
896 views