如何 判断 ‘234’与 ‘432’是一样的只是位置不一样
------解决方案--------------------
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