Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deleting Tabs From a string with PLSQL

0 views
Skip to first unread message

Greg Teets

unread,
Jan 29, 2001, 5:13:18 PM1/29/01
to
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

Mike Krolewski

unread,
Jan 29, 2001, 6:44:22 PM1/29/01
to
In article <3a75ebf7.68060706@news-server>,

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
mkrol...@rii.com
Usual disclaimers


Sent via Deja.com
http://www.deja.com/

Greg Teets

unread,
Jan 29, 2001, 8:29:06 PM1/29/01
to
It worked.

Thanks.

On Mon, 29 Jan 2001 23:44:22 GMT, Mike Krolewski <mkrol...@rii.com>
wrote:

0 new messages