oracle自定义字符串转换为大写函数

直接上代码,可将字符串转换为大写。

create or replace function cusfun_upper(str varchar) return varchar

as 

  idex number;

  outstr varchar2(32767);

  nowAscii number;

begin

  select 1 into idex from dual;

  loop

    select ascii(substr(str,idex,1)) into nowAscii from dual;

    if nowAscii>=97 and nowAscii<=122 then

      select outstr||CHR(nowAscii-32) into outstr from dual;

    elsif nowAscii>=65 and nowAscii<=90 then

      select outstr||CHR(nowAscii) into outstr from dual;

    else

      select outstr||CHR(nowAscii) into outstr from dual;

    end if;

    idex := idex+1;

    if idex>length(str) then

      return outstr;

    end if;

  end loop;

end;


爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img