码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2017-05-12 09:37:22      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:阿拉伯   oracle   code   images   ace   rac   func   turn   pre   

  本博客是自己在学习和工作途中的积累与总结。

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

  

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即可。
技术分享

 

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

标签:阿拉伯   oracle   code   images   ace   rac   func   turn   pre   

原文地址:http://www.cnblogs.com/king-xg/p/6839738.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!