Solved

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

Posted on 2007-11-29
2
2,389 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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
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.

762 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

9 Experts available now in Live!

Get 1:1 Help Now