Geeks Talk

Prepare for your Next Interview




Identify blank spaces in a string

This is a discussion on Identify blank spaces in a string within the Oracle forums, part of the Databases category; I have to take an input from user at run time of a procedure. And i have to find out the blank space in given string and have to trim ...


Go Back   Geeks Talk > Databases > Oracle

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-13-2008
Junior Member
 
Join Date: May 2007
Location: bangalore
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
loosecontrol is on a distinguished road
Identify blank spaces in a string

I have to take an input from user at run time of a procedure. And i have to find out the blank space in given string and have to trim all such blank spaces. How exactly can we identify blank space.

How can i do that. As we know using trim we can trim spaces at front or rear end of a string, but how we can trim spaces from mid of the string?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-13-2008
Junior Member
 
Join Date: Nov 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
knowledgebalaji is on a distinguished road
Re: Identify blank spaces in a string

Hi,

kindly try this query

select Replace(' Hi what is ur name' ,' ') from dual;
Reply With Quote
  #3 (permalink)  
Old 03-14-2008
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,432
Thanks: 8
Thanked 126 Times in 113 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: Identify blank spaces in a string

You can try using Replace , Translate or combination of both for the purpose.
Reply With Quote
  #4 (permalink)  
Old 04-02-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Identify blank spaces in a string

Quote:
Originally Posted by debasisdas View Post
You can try using Replace , Translate or combination of both for the purpose.
I tried to remove blank spaces using translate as follows
SQL> select translate(' Hi what is ur name' ,' ','') from dual;

T
-


OUTPUT is NULL.
I think ,while using translate funcion Oracle interprets the empty string as null, and if this function has a null argument, then it returns null.

Is there any other way to remove blank spaces using translate function?

Can anyone post an example for that?
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Identify New Records rajpandu Data Warehousing 5 03-30-2008 11:47 PM
Difference between String.Convert Vs String.ToString jbanx C# 6 03-24-2008 01:02 PM
What will be the answer whether spaces or compiler error kanchhana MainFrame 1 06-26-2007 01:25 PM
display string without having underscore if we send string with underscore ausprem2000 Oracle 1 05-28-2007 07:46 AM
Identify the Ball christia Brainteasers 1 08-17-2006 11:11 AM


All times are GMT -4. The time now is 09:58 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved