Finding and removing non ascii characters from an Oracle Varchar2 Finding and removing non ascii characters from an Oracle Varchar2 oracle oracle

Finding and removing non ascii characters from an Oracle Varchar2


I think this will do the trick:

SELECT REGEXP_REPLACE(COLUMN, '[^[:print:]]', '')


If you use the ASCIISTR function to convert the Unicode to literals of the form \nnnn, you can then use REGEXP_REPLACE to strip those literals out, like so...

UPDATE table SET field = REGEXP_REPLACE(ASCIISTR(field), '\\[[:xdigit:]]{4}', '')

...where field and table are your field and table names respectively.


I wouldn't recommend it for production code, but it makes sense and seems to work:

SELECT REGEXP_REPLACE(COLUMN,'[^' || CHR(1) || '-' || CHR(127) || '],'')