Solved

how to delete extra empty spaces

Posted on 2015-01-20
10
94 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 48

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.

Join & Write a Comment

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup

757 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

22 Experts available now in Live!

Get 1:1 Help Now