日期:2014-05-17 浏览次数:20822 次
create or replace function isSame(str1 varchar2,str2 varchar2) return varchar2
is
flag varchar2(10) := 'false';
i number := 0;
strtemp varchar2(100);
begin
if str1 is null or str2 is null then
return flag;
elsif length(str1) != length(str2) then
return flag;
else
loop
i := i + 1;
exit when i = length(str1) or instr(str1,strtemp) = 0;
strtemp := substr(str2,i,1);
end loop;
if i = length(str1) then
flag := 'true';
end if;
end if;
return flag;
end;
SQL> select isSame('234','432') from dual;
ISSAME('234','432')
--------------------------------------------
true