oracle改进之将阿拉伯数字转换成中文数字

  本博客是自己在学习和工作途中的积累与总结,仅供自己参考,也欢迎大家转载,转载时请注明出处

   http://www.cnblogs.com/king-xg/p/6839738.html

 将阿拉伯数字转换成中文汉字,方法自定义函数
  

  

create or replace function formate(val in number)
return varchar2 is res varchar2(6);

begin
  if val=1 then res:='';
  elsif val=2 then res:='';
  elsif val=3 then res:='';
  elsif val=4 then res:='';
  elsif val=5 then res:='';
  elsif val=6 then res:='';
  elsif val=7 then res:='';
  elsif val=8 then res:='';
  elsif val=9 then res:='';
  elsif val=10 then res:='';
  elsif val=11 then res:='十一';
  elsif val=12 then res:='十二';
  elsif val=13 then res:='十三';
  elsif val=14 then res:='十四';
  elsif val=15 then res:='十五';
  elsif val=16 then res:='十六';
  elsif val=16 then res:='十七';
  elsif val=16 then res:='十八';
  elsif val=16 then res:='十九';
  elsif val=16 then res:='二十';
  elsif val=16 then res:='二十一';
  elsif val=16 then res:='二十二';
  elsif val=16 then res:='二十三';
  elsif val=16 then res:='二十四';
  elsif val=16 then res:='二十五';
  elsif val=16 then res:='二十六';
  elsif val=16 then res:='二十七';
  elsif val=16 then res:='二十八';
  elsif val=16 then res:='二十九';
  elsif val=16 then res:='三十';
  elsif val=16 then res:='三十一';
  elsif val=16 then res:='三十二';
  elsif val=16 then res:='三十三';
  elsif val=16 then res:='三十四';
  elsif val=16 then res:='三十五';
  elsif val=16 then res:='三十六';
  elsif val=16 then res:='三十七';
  elsif val=16 then res:='三十八';
  elsif val=16 then res:='三十九';
  elsif val=16 then res:='四十';
  elsif val=16 then res:='四十一';
  elsif val=16 then res:='四十二';
  else
    res:='';
  end if;
  return res;
end;

 如果还有延展,就往后叠加elsif即可。

 

转载于:https://www.cnblogs.com/king-xg/p/6839738.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值