Solved

how to delete extra empty spaces

Posted on 2015-01-20
10
98 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 50

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
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 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
 
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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

766 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