• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 73
  • Last Modified:

Remove double-quotes and carriage-return, line-feeds out of column data

Write an update statement to remove double-quotes and carriage-return, line-feeds out of a columns data.

--I thought this would work to remove the carriage-returns, line feeds but get a
--ora-01722:invalid number error where the datatype for column1 is varchar2(50).
Update mytable
set column1 = replace(column1, chr(13) + chr(10), '')

--tried for removing the double-quotes and did not remove them.
Update mytable
set column1 = replace(column1, '"', '')

Using Oracle 11g

Thanks
0
Machinegunner
Asked:
Machinegunner
  • 2
  • 2
1 Solution
 
slightwv (䄆 Netminder) Commented:
+ isn't Oracle.

You can try:
set column1 = replace(column1, chr(13) || chr(10))

Honestly, I've always done two replaces:
set column1 = replace(replace(column1, chr(13)),chr(10))

You don't need the empty string since that is a null in Oracle and replace defaults to null.


The double quote replace looks fine to me.  Make sure the data has an actual double quote and not something like a "smart quote".

You can use the DUMP SQL function to verify the data:
select dump(column1) from myTable;
0
 
MachinegunnerAuthor Commented:
Thanks for the information
when I did the select dump statement it returns a 'Typ-1 Len=8: 48,48,48,48,50,54,53,10' value on the column
so it might be a smart quote or something else maybe..
0
 
MachinegunnerAuthor Commented:
Thanks for the info
0
 
slightwv (䄆 Netminder) Commented:
>>value on the column

That column only contained numbers and a linefeed.

I get:  0000265

My go to reference:
http://www.asciitable.com/
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now