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?
Re: Identify blank spaces in a string
Hi,
kindly try this query
select Replace(' Hi what is ur name' ,' ') from dual;
Re: Identify blank spaces in a string
You can try using Replace , Translate or combination of both for the purpose.
Re: Identify blank spaces in a string
[QUOTE=debasisdas;27660]You can try using Replace , Translate or combination of both for the purpose.[/QUOTE]
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?
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