Home » SQL & PL/SQL » SQL & PL/SQL » Query (oracle)
Query [message #326977] Fri, 13 June 2008 05:00 Go to next message
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 #326979 is a reply to message #326977] Fri, 13 June 2008 05:11 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
what are you trying to achieve ??

where is the question??
Re: Query [message #326984 is a reply to message #326977] Fri, 13 June 2008 05:15 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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
Re: Query [message #327001 is a reply to message #326990] Fri, 13 June 2008 06:03 Go to previous message
convey05
Messages: 43
Registered: December 2007
Location: CHENNAI
Member
Hi,
Thank you.It is working fine
Previous Topic: about sql queries
Next Topic: SQL Output Formatting
Goto Forum:
  


Current Time: Sat Nov 02 13:47:04 CDT 2024