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即可。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM