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: Deleting Tabs From a string with PLSQL

Re: Deleting Tabs From a string with PLSQL

From: Mike Krolewski <mkrolewski_at_rii.com>
Date: Mon, 29 Jan 2001 23:44:22 GMT
Message-ID: <954v8k$p1f$1@nnrp1.deja.com>

In article <3a75ebf7.68060706_at_news-server>,   gteets_at_rr.cinci.com (Greg Teets) wrote:
> I have a column of text. Some of the strings in
> the table have tabs in them. I have been working
> with LTRIM in PL/SQL to remove the tabs but cannot get it
> to work.
>
> I assume I would set the second parameter to a
> tab, presumably using the ASCII code for tab.
>
> If someone has done this, please let me know how
> to do it. I am working on Windows NT.
>
> Thank you.
>
> Greg Teets
> Cincinnati, OH
>
>

Not to sound too trite, why are you assuming the second parameter is ..

Check the manual.

In the SQL Refence manual:

Purpose
LTRIM removes characters from the left of char, with all the leftmost characters that appear in set removed; set defaults to a single blank. If char is a character literal, you must enclose it in single quotes. Oracle begins scanning char from its first character and removes all characters that appear in set until reaching a character not in set and then returns the result.

Example
SELECT LTRIM(’xyxXxyLAST WORD’,’xy’) "LTRIM example" FROM DUAL;

LTRIM example



XxyLAST WORD

Personally, I would use replace to remove the tabs and replace them with spaces, then ltrim with the default to remove leading spaces.

ltrim( replace( <field>, chr(9), ' '))

Note to use tab plus other characters use || eg chr(9)|| 'xyz'

This is a lot of work for a query. I presume you are cleaning up the data.

--
Michael Krolewski
Rosetta Inpharmatics
mkrolewski_at_rii.com
              Usual disclaimers


Sent via Deja.com
http://www.deja.com/
Received on Mon Jan 29 2001 - 17:44:22 CST

Original text of this message

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