Finding and removing non ascii characters from an Oracle Varchar2

前端 未结 17 2172
猫巷女王i
猫巷女王i 2020-12-02 23:03

We are currently migrating one of our oracle databases to UTF8 and we have found a few records that are near the 4000 byte varchar limit. When we try and migrate these reco

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 23:36

    Try the following:

    -- To detect
    select 1 from dual
    where regexp_like(trim('xx test text æ¸¬è© ¦ “xmx” number²'),'['||chr(128)||'-'||chr(255)||']','in')
    
    -- To strip out
    select regexp_replace(trim('xx test text æ¸¬è© ¦ “xmxmx” number²'),'['||chr(128)||'-'||chr(255)||']','',1,0,'in')
    from dual
    

提交回复
热议问题