Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to replace text field with $ with text field less $ 1

Status
Not open for further replies.

Hillary

Programmer
Feb 15, 2002
377
US
I'm new to SQL writting and need help updating a field. My goal is to remove the $ from the field and keep the rest of the information the same. The database is running on ORACLE 8i.

The table I am working with has 25,000 records. 2,000 of these have had a dollar value entered into a text field ({User_9}). Of the 2,000, 1,300 had the $ included with the data. This causes a problem in Crystal Reports because I cannot convert the data into a number with the $.

I wrote a statement with SQL Plus Worksheet to extract the ID's from the table ({Part})where text field started with '$'...
Select ID from Part where User_9 like '$%';

How do I update User_9 with User_9 less the $?

Example $5.02 should be 5.02 or $.0032 should be .0032

Thanks for you help!
Hillary
 
Set User_9 = REPLACE(User_9 ,'$') will replace ALL $'s.
 
Sorry brain failure - I meant will REMOVE all $'s
 
Does this work?

UPDATE myTable SET user_9 = SUBSTR(user_9,2,LENGTH(user_9)-1) -----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top