Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to trim substrings?
Rauf Sarwar wrote:
> RK wrote:
>> Help, please. >> >> I have to query a table to trim a certain field, and to catch its >> certain substrings. The tool I know is like ltrim() or rtrim(), >> something like >> >> >> select ltrim(ltrim(field_1,'a'),'b') from table_1; >> >> or >> >> select count(*) from table_1 where rtrim(field_1,'b') = 'xxc'; >> >> >> I know ltrim() or rtrim() only trim out one character/digit once. How >> can I get all of the required results if I have more repeated 'a' to >> the left or 'b' to the right? Like >> >> aHaveOne >> aaHaveTwo >> abaabHaveMore >> >> ... >> >> This must be done purely by SQL*Plus query. Thanks.
Or possibly use translate.
Demo in Morgan's Library at www.psoug.org
-- Daniel A. Morgan http://www.psoug.org damorgan_at_x.washington.edu (replace x with u to respond)Received on Sat Mar 18 2006 - 09:56:19 CST