Solved

how to delete extra empty spaces

Posted on 2015-01-20
10
95 Views
Last Modified: 2015-02-02
hi ow can i get value in column which got extra empty spaces and delete those extra spaces

value object  
must be
object
0
Comment
Question by:chalie001
10 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40559474
Hi,

Do you mean ?

TRIM('   word   ')

Regards
0
 
LVL 5

Expert Comment

by:GuruJava
ID: 40559475
Hi you can use

TRIM( [ [ LEADING | TRAILING | BOTH ] trim_character FROM ] string1 )

TRIM('   tech   ')
Result: 'tech'

TRIM(' '  FROM  '   tech   ')
Result: 'tech'

TRIM(LEADING '0' FROM '000123')
Result: '123'

TRIM(TRAILING '1' FROM 'Tech1')
Result: 'Tech'

TRIM(BOTH '1' FROM '123Tech111')
Result: '23Tech'
0
 

Author Comment

by:chalie001
ID: 40559603
i have a word like this
Object > Object > Basic Item Information > Creation

and sql is

select * from temp_unt
where  learning_unit_name = TRIM(TRAILING ' ' FROM learning_unit_name)

i what empty spaces at the end and/or back of the word not in middle
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40559625
If TRIM isn't working for you, please post sample data and expected results.

Post the data in a 'code' block to preserve the spaces.

Click 'Code' in the menu directly above the box where you type your posts and enter the data inside the tags or select/highlight the text and click 'Code'.

This is a code block

Open in new window

0
 

Author Comment

by:chalie001
ID: 40561321
ok i what

'Object > Object > Basic Item Information > Creation '
or
' Object > Object > Basic Item Information > Creation'

to be like this 
'Object > Object > Basic Item Information > Creation'

Open in new window

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Helena Marková
ID: 40561676
Here is another option:
select LTRIM(RTRIM(' Object > Object > Basic Item Information > Creation')) col1 from dual;
0
 

Author Comment

by:chalie001
ID: 40561810
if i what to remove those extra empty spaces from all values which got extra empty spaces how can i do that i do this

 
somethint like this

update cal_obj

set obj_name = trim(obj_name)

 
e.g

 
obj_name

'Object > Object > Basic Item Information > Creation '

'Object > Object > Basic Item Information > test '

' Object > Object > Basic Item Information > new'



i what values to be like this after update

obj_name

'Object > Object > Basic Item Information > Creation'

'Object > Object > Basic Item Information > test'

'Object > Object > Basic Item Information > new'
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40561835
>>somethint like this


The trim you posted will do exactly that.  What else is needed?

update some_table set some_column=trim(some_column);
0
 

Author Comment

by:chalie001
ID: 40564162
i have run the following query
update cal_book
         
set description = rtrim(description,' ')
          where obj_name = 'LLCOSD03.form'
          and learning_unit_number = '2';
          
          but after i comit am still geting an extry emty space in front of the value
          select * from cal_book
          where obj_name = 'LLCOSD03.form'
           and learning_unit_number = '2';

Open in new window

e.g

' test value'

to be this after update
'test value'
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40564200
RTRIM trims 'R'ight.

Just use regular TRIM like I posted.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
one-way data "masking" MD5 sql 26 146
null value 15 94
Question About Creating Primary Key Constraints on Oracle Tables... 5 38
Oracle sql query 7 49
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now