create or replace procedure proc_convert(in_str varchar2,out_str out varchar2)
is
v_str varchar2(3000);
v_pos integer;
v_len integer;
v_dtl char(1);
begin
v_pos:=1;
v_str:=in_str;
begin
select length(in_str)
into v_len
from dual;
exception
when no_data_found then
null;
end;
while (v_pos<=v_len) loop
v_dtl:=substr(v_str,v_pos,1);
if to_number(ascii(v_dtl)) between 97 and 122 then
--替换
v_str:=replace(v_str,v_dtl,upper(v_dtl));
v_str:=substr(v_str,1,v_pos-1)||upper(v_dtl)||substr(v_str,v_pos+1);
--然后替换
else
--转换
--然后替换
--v_str:=replace(v_str,v_dtl,lower(v_dtl));
v_str:=substr(v_str,1,v_pos-1)||lower(v_dtl)||substr(v_str,v_pos+1);
end if;
v_pos:=v_pos+1;
end loop;
out_str:=v_str;
end proc_convert;
此存储过程仍有问题,还需要进一步修改!
is
v_str varchar2(3000);
v_pos integer;
v_len integer;
v_dtl char(1);
begin
v_pos:=1;
v_str:=in_str;
begin
select length(in_str)
into v_len
from dual;
exception
when no_data_found then
null;
end;
while (v_pos<=v_len) loop
v_dtl:=substr(v_str,v_pos,1);
if to_number(ascii(v_dtl)) between 97 and 122 then
--替换
v_str:=replace(v_str,v_dtl,upper(v_dtl));
v_str:=substr(v_str,1,v_pos-1)||upper(v_dtl)||substr(v_str,v_pos+1);
--然后替换
else
--转换
--然后替换
--v_str:=replace(v_str,v_dtl,lower(v_dtl));
v_str:=substr(v_str,1,v_pos-1)||lower(v_dtl)||substr(v_str,v_pos+1);
end if;
v_pos:=v_pos+1;
end loop;
out_str:=v_str;
end proc_convert;
此存储过程仍有问题,还需要进一步修改!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-702588/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-702588/