I'm trying to remove non-ascii characters using PL SQL. I tried to use the codes below but it also removes carriage returns which is I don't want. Please advice.
select REGEXP_REPLACE('sample string', '[^[:print:]]', '') from dual;
Change the regexp to (not printable OR carriage return/newline).
WITH t (txt) AS
(
SELECT 'Hello'||chr(13)||' World' FROM DUAL
)
select REGEXP_REPLACE(txt, '[^[:print:|\x0A|\x0B|`\x0D]]', '') from t;
REGEXP_REPLA
------------
Hello
World
Nicely explained here