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: Simple SQL question

Re: Simple SQL question

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Tue, 31 Jan 2006 18:36:01 +0100
Message-ID: <43dfa005$0$700$626a14ce@news.free.fr>

"Jeremy" <jeremy0505_at_gmail.com> a écrit dans le message de news: MPG.1e49a4898817539498a0d2_at_news.individual.net...
|
|
| How many times have you seen a subject like that :)
|
| If I want to remove all superfluous spaces from a string, can I do it in
| one statement?
|
| e.g. if to convert
| 'the cat sat on the mat'
| to
| 'the cat sat on the mat'
|
| I could code as a loop until the string contains no ' ' (i.e. 2 spaces)
| but that seems a bit sledgehammer/nut?
|
| i.e.
|
| declare
| l_str varchar2(80) := 'the cat sat on the mat';
| begin
| loop
| exit when instr(l_str,' ') = 0;
| l_str := replace(l_str,' ',' ');
| end loop;
| dbms_output.put_line(l_str);
| end;
| /
|
| That works... but isn't pretty.
|
|
| --
| jeremy
|
| We use Oracle 9iR2 on Solaris 8 with the Oracle HTTP Server and
| mod_plsql

I put 2 SQL solutions of this problem at:

http://asktom.oracle.com/pls/ask/f?p=4950:61:15900582171083902697::::P61_ID:13912709295209#55584525542979

Regards
Michel Cadot Received on Tue Jan 31 2006 - 11:36:01 CST

Original text of this message

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