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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to clean up corrupted varchar2 field

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I have several hundred records in a table that appear to have been converted years ago from some previous database. I just happened to be doing some reporting on these old records and found that they have embedded in the "notes" column a chr(236)chr(10) so when i do a report that contains these records my report format is screwed up. I can select these records with:

select notes from mytable where notes like '%'||chr(236)||chr(10)||'%'

the question now is, how can i strip these chr(236) and chr(10) out of my notes column?

any suggestions would be appreciated..

 
I infer from your original post that the characters you wish to eliminate are always adjacent. Also, since those characters could be between words and their simple elimination might cause the running together of the word to the left with the word to the right, I propose that we replace those two characters with a single blank space. Here, then is the code that I recommend:
Code:
UPDATE <table_name>
  SET notes = replace(notes,chr(236)||chr(10),' ')
WHERE notes like '%'||chr(236)||chr(10)||'%';
Let us know if this satisfactorily resolves your need.


[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
you're absolutely correct...

thanks
 
Nice one Dave, the replace was simple, but realizing that you should replace it with a space instead of just killing them was a nice catch.

Bill
Oracle DBA/Developer
New York State, USA
 
Very thoughtful of you to feel that way. [2thumbsup]

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top