Re: Help: Blank spaces

From: Jurij Modic <jmodic_at_src.si>
Date: Tue, 02 Feb 1999 22:52:30 GMT
Message-ID: <36b77f7a.20395464_at_news.siol.net>


On Tue, 02 Feb 1999 14:48:30 -0600, Austin Moseley <austinmoseley_at_hotmail.com> wrote:

>The replace( str, r1, r2 ) function in Oracle will replace ALL
>occurrences of r1 in str with r2, regardless of how many times
>r1 appears.
>
>..REPLACE( 'test 1111', '1','2') ...
>
>returns 'test 2222'.
>
>No need to do the following:
>
>> 2 REPLACE(
>> 3 REPLACE('this is a string',
>> 4 ' ', ' '), -- 4 blanks into 1
>> 5 ' ', ' '), -- 3 blanks into 1
>> 6 ' ', ' ') -- 2 blanks into 1
>> 7 FROM DUAL;
>>
>> REPLACE(REPLACE(
I guess you didn't read the original posters demands: he wants to remove all the consecutive blanks but leave only one! So with your example -
>..REPLACE( 'test 1111'
he would wan't to get 'test 1' (we want to leave only one '1' and remove all the trailing '1' up to the next character different from '1'). And it surely can't be done with a simple single REPLACE function.

Regards,

Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Tue Feb 02 1999 - 23:52:30 CET

Original text of this message