您的位置:首页 > 数据库 > Oracle

加密脚本(ORACLE函数)

2018-01-09 09:44 253 查看
create or replace function encode(str varchar2) return varchar2 is
Result varchar2(20);
len number;
i number;
s varchar2(1);
begin
Result:='';
len:=length(str);
if(len is null) then return(null);
end if;
for i in 1..len
loop
s:=substr(str,i,1);
if (s='0') then Result:=Result||'5'; end if;
if (s='1') then Result:=Result||'0'; end if;
if (s='2') then Result:=Result||'9'; end if;
if (s='3') then Result:=Result||'1'; end if;
if (s='4') then Result:=Result||'3'; end if;
if (s='5') then Result:=Result||'7'; end if;
if (s='6') then Result:=Result||'4'; end if;
if (s='7') then Result:=Result||'8'; end if;
if (s='8') then Result:=Result||'2'; end if;
if (s='9') then Result:=Result||'6'; end if;
end loop;
return(Result);
end encode;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息