Results 1 to 5 of 5

Thread: Identify blank spaces in a string

  1. #1
    Junior Member
    Join Date
    May 2007
    Answers
    5

    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?


  2. #2

    Re: Identify blank spaces in a string

    Hi,

    kindly try this query

    select Replace(' Hi what is ur name' ,' ') from dual;


  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Identify blank spaces in a string

    You can try using Replace , Translate or combination of both for the purpose.


  4. #4
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    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?


  5. #5
    Junior Member
    Join Date
    Mar 2011
    Answers
    1

    Re: Identify blank spaces in a string

    hi, good afternoon, you can try something like this>


    select replace('test of removing blanks padded between a string',' ',null) from dual


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact