转化某个字母字符串为反向大小写存储过程

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;


此存储过程仍有问题,还需要进一步修改!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-702588/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9240380/viewspace-702588/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值