Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Removing space padding from INSIDE a string?

Re: Removing space padding from INSIDE a string?

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 20 Oct 2005 10:49:55 -0700
Message-ID: <1129830589.404604@yasure>


scholzie wrote:
> My company's database has a field where a part number is. It's supposed
> to be an unbroken string (with no spaces), but the auto-loading
> software is putting spaces in. Example: 'par tnu mber 3' where I really
> want the value 'partnumber3'
>
> I've tried to use trim(' ' from part), but that only takes care of left
> and right padding. How can I remove all the spaces from inside a
> string?
>
> TIA
SELECT TRANSLATE(<column_name>, 'A ', 'A') FROM <your_table>

Captial 'A' is replaced by itself. All spaces are eliminated no matter where they are and without regard to how many there are.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Thu Oct 20 2005 - 12:49:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US