Solved

How do I remove leading space in last name field in Oracle table?

Posted on 2007-11-29
2
2,391 Views
Last Modified: 2013-12-18
I am using Oracle 10 and would like to write an update query to remove a leading space that was put in the last name field by mistake.  I have figured out how to find out what records have the leading space, but I'm stuck on the sql to actually update the data.

Thanks for your help.
Sarah

0
Comment
Question by:spendergrass
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 20377658
please try this syntax:
UPDATE yourtable 
  SET yourfield = TRIM(leading ' ' from yourfield)
WHERE yourfield like ' %'

Open in new window

0
 

Author Closing Comment

by:spendergrass
ID: 31411806
That worked perfectly.  Thank you.
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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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 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.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

776 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