Solved

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

Posted on 2007-11-29
2
2,394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
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 shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

627 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