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

Machinegunner
Machinegunner used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018
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;

Author

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..

Author

Commented:
Thanks for the info
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>>value on the column

That column only contained numbers and a linefeed.

I get:  0000265

My go to reference:
http://www.asciitable.com/

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial