Query [message #326977] |
Fri, 13 June 2008 05:00 |
convey05
Messages: 43 Registered: December 2007 Location: CHENNAI
|
Member |
|
|
Hi all,
I have get an output from this string like this
select ' good day welcome '
from dual;
Only one space in between each word.
output:
good day welcome
Can anyone tell me how to get it
Thanks in advance
|
|
|
|
Re: Query [message #326984 is a reply to message #326977] |
Fri, 13 June 2008 05:15 |
nasir_mughal
Messages: 122 Registered: April 2007 Location: Karachi
|
Senior Member |
|
|
Are you looking something like this
select trim(' good day welcome ')
from dual
/
TRIM('GOODDAYWEL
----------------
good day welcome
|
|
|
Re: Query [message #326989 is a reply to message #326984] |
Fri, 13 June 2008 05:29 |
convey05
Messages: 43 Registered: December 2007 Location: CHENNAI
|
Member |
|
|
I have a string with lot of spaces in between each word,before and after the string.
If i use trim only left and right of the string the space is removed.But the space (more than 1 space)in between each word should be removed and displayed.
|
|
|
Re: Query [message #326990 is a reply to message #326989] |
Fri, 13 June 2008 05:32 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
If you're on 10g you can do this:SQL> select regexp_replace(' Hello World ','[ ]{2,}',' ') from dual;
REGEXP_REPLAC
-------------
Hello World
|
|
|
|