oracle去除常见特殊字符方法
Posted 沧海·
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle去除常见特殊字符方法相关的知识,希望对你有一定的参考价值。
网上找了一大圈没找到想要的 于是自己手写了一份。有需要的朋友拿走,走前留个赞,谢谢。
create or replace function FUNC_STRING_CLEAN(data IN VARCHAR2) return varchar2
IS
data1 VARCHAR2 (2000);
begin
data1:=data;
if instr(data1,chr(39))>0 then
data1 := replace(data1,chr(39),'');
end if;
if instr(data1,'"')>0 then
data1 := replace(data1,'"','');
end if;
if instr(data1,'`')>0 then
data1 := replace(data1,'`','');
end if;
if instr(data1,'!')>0 then
data1 := replace(data1,'!','');
end if;
if instr(data1,'(')>0 then
data1 := replace(data1,'(','');
end if;
if instr(data1,')')>0 then
data1 := replace(data1,')','');
end if;
if instr(data1,'*')>0 then
data1 := replace(data1,'*','');
end if;
if instr(data1,'^')>0 then
data1 := replace(data1,'^','');
end if;
if instr(data1,'~')>0 then
data1 := replace(data1,'~','');
end if;
if instr(data1,'……')>0 then
data1 := replace(data1,'……','');
end if;
if instr(data1,'%')>0 then
data1 := replace(data1,'%','');
end if;
if instr(data1,'——')>0 then
data1 := replace(data1,'——','');
end if;
if instr(data1,'-')>0 then
data1 := replace(data1,'-','');
end if;
if instr(data1,'+')>0 then
data1 := replace(data1,'+','');
end if;
if instr(data1,'=')>0 then
data1 := replace(data1,'=','');
end if;
if instr(data1,'[')>0 then
data1 := replace(data1,'[','');
end if;
if instr(data1,'')>0 then
data1 := replace(data1,'','');
end if;
if instr(data1,']')>0 then
data1 := replace(data1,']','');
end if;
if instr(data1,'')>0 then
data1 := replace(data1,'','');
end if;
if instr(data1,'|')>0 then
data1 := replace(data1,'|','');
end if;
if instr(data1,'/')>0 then
data1 := replace(data1,'/','');
end if;
if instr(data1,';')>0 then
data1 := replace(data1,';','');
end if;
if instr(data1,':')>0 then
data1 := replace(data1,':','');
end if;
if instr(data1,'”')>0 then
data1 := replace(data1,'”','');
end if;
if instr(data1,'“')>0 then
data1 := replace(data1,'“','');
end if;
if instr(data1,'"')>0 then
data1 := replace(data1,'"','');
end if;
if instr(data1,';')>0 then
data1 := replace(data1,';','');
end if;
if instr(data1,',')>0 then
data1 := replace(data1,',','');
end if;
if instr(data1,',')>0 then
data1 := replace(data1,',','');
end if;
if instr(data1,'<')>0 then
data1 := replace(data1,'<','');
end if;
if instr(data1,'《')>0 then
data1 := replace(data1,'《','');
end if;
if instr(data1,'>')>0 then
data1 := replace(data1,'>','');
end if;
if instr(data1,'》')>0 then
data1 := replace(data1,'》','');
end if;
if instr(data1,'。')>0 then
data1 := replace(data1,'。','');
end if;
if instr(data1,'.')>0 then
data1 := replace(data1,'.','');
end if;
if instr(data1,'?')>0 then
data1 := replace(data1,'?','');
end if;
if instr(data1,'、')>0 then
data1 := replace(data1,'、','');
end if;
if instr(data1,'@')>0 then
data1 := replace(data1,'@','');
end if;
if instr(data1,'#')>0 then
data1 := replace(data1,'#','');
end if;
if instr(data1,'¥')>0 then
data1 := replace(data1,'¥','');
end if;
if instr(data1,'$')>0 then
data1 := replace(data1,'$','');
end if;
if instr(data1,'!')>0 then
data1 := replace(data1,'!','');
end if;
if instr(data1,'*')>0 then
data1 := replace(data1,'*','');
end if;
if instr(data1,' ')>0 then
data1 := replace(data1,' ','');
end if;
if instr(data1,'&')>0 then
data1 := replace(data1,'&','');
end if;
return data1;
end FUNC_STRING_CLEAN;
以上是关于oracle去除常见特殊字符方法的主要内容,如果未能解决你的问题,请参考以下文章