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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Strange whitespace hard to trim off

Re: Strange whitespace hard to trim off

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Fri, 10 Jan 2003 08:30:00 -0800
Message-ID: <3E1EF507.75C2AEE3@exesolutions.com>


C Chang wrote:

> Mark D Powell wrote:
> >
> > C Chang <cschang_at_maxinter.net> wrote in message news:<3E1CF430.2E7D_at_maxinter.net>...
> > > I have a record ( submitted by customer) as M123-1-9. When I count the
> > > length of it, it has 9 characters. I use -
> > > Select part , LENGTH(RTRIM(part)) p from ... to remove the whitespace
> > > off. However I still have 9 after the process. I have tried various
> > > chr() such as new-line, space, return character, none of them work. I
> > > tested with SUBSTR(part, 8,2) ||'*" and confirmed it to be a whitespace
> > > as 9 *. I just could not trim it off. Does anyone have a better
> > > suggestion?
> > > C Chang
> >
> > The rtrim function defaults to space (blank) as the character to be
> > trimmed. Use the DUMP function to see what the trailing characters
> > are and then use RTRIM (other possibilites trim, replace, and
> > transform) to eliminate them. See the SQL manual chapter on single
> > row functions for the full syntax.
> >
> > HTH -- Mark D Powell --
> Thanks Mark. I never use the DUMP function and I will try. I have
> tried with the RTRIM function (LTRIM as well) but it won't trim off the
> whitespace, because the LENGTH(RTRIM(...)) gave the same lenght as
> before. By the way, I have Oracle 8.1.6 on NT 4. as example:
>
> SELECT part, SUBSTR(part, 9,2) ||'*' c, LENGTH(PART) l,
> LENGTH(RTRIM(part) pl FROM ...
>
> part c l pl
> ---------- ---- ---- ----
> MS123-1-9 9 * 10 10
>
> C chang

Using your example above you could try this:

SELECT ASCII(SUBSTR(part,2,1) FROM ...

That will give you the ASCII number of whatever character is there.

Daniel Morgan Received on Fri Jan 10 2003 - 10:30:00 CST

Original text of this message

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