金额大写转小写SQL

金额大写转小写SQL,第1张

概述金额大写转小写SQL

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

Create Or Replace Function Money2Chinese(Money In Number) Return Varchar2 Is  strYuan       Varchar2(150);  strYuanFen    Varchar2(152);  numLenYuan    Number;  numLenYuanFen Number;  strRstYuan    Varchar2(600);  strRstFen     Varchar2(200);  strRst        Varchar2(800);  Type typeTabMapPing Is table Of Varchar2(2) Index By Binary_Integer;  tabNumMapPing  typeTabMapPing;  tabUnitMapPing typeTabMapPing;  numunitIndex   Number;  i              Number;  j              Number;  charCurrentNum Char(1);Begin  If Money Is Null Then    Return Null;  End If;  strYuan := TO_CHAR(FLOOR(Money));  If strYuan = '0' Then    numLenYuan := 0;    strYuanFen := lpad(TO_CHAR(FLOOR(Money * 100)),2,'0');  Else    numLenYuan := length(strYuan);    strYuanFen := TO_CHAR(FLOOR(Money * 100));  End If;  If strYuanFen = '0' Then    numLenYuanFen := 0;  Else    numLenYuanFen := length(strYuanFen);  End If;  If numLenYuan = 0 Or numLenYuanFen = 0 Then    strRst := '零圆整';    Return strRst;  End If;  tabNumMapPing(0) := '零';  tabNumMapPing(1) := '壹';  tabNumMapPing(2) := '贰';  tabNumMapPing(3) := '叁';  tabNumMapPing(4) := '肆';  tabNumMapPing(5) := '伍';  tabNumMapPing(6) := '陆';  tabNumMapPing(7) := '柒';  tabNumMapPing(8) := '捌';  tabNumMapPing(9) := '玖';  tabUnitMapPing(-2) := '分';  tabUnitMapPing(-1) := '角';  tabUnitMapPing(1) := '';  tabUnitMapPing(2) := '拾';  tabUnitMapPing(3) := '佰';  tabUnitMapPing(4) := '仟';  tabUnitMapPing(5) := '万';  tabUnitMapPing(6) := '拾';  tabUnitMapPing(7) := '佰';  tabUnitMapPing(8) := '仟';  tabUnitMapPing(9) := '亿';  For i In 1 .. numLenYuan Loop    j            := numLenYuan - i + 1;    numunitIndex := Mod(i,8);    If numunitIndex = 0 Then      numunitIndex := 8;    End If;    If numunitIndex = 1 And i > 1 Then      strRstYuan := tabUnitMapPing(9) || strRstYuan;    End If;    charCurrentNum := substr(strYuan,j,1);    If charCurrentNum <> 0 Then      strRstYuan := tabNumMapPing(charCurrentNum) ||                    tabUnitMapPing(numunitIndex) || strRstYuan;    Else      If (i = 1 Or i = 5) Then        If substr(strYuan,j - 3,4) <> '0000' Then          strRstYuan := tabUnitMapPing(numunitIndex) || strRstYuan;        End If;      Else        If substr(strYuan,j + 1,1) <> '0' Then          strRstYuan := tabNumMapPing(charCurrentNum) || strRstYuan;        End If;      End If;    End If;  End Loop;  For i In -2 .. -1 Loop    j              := numLenYuan - i;    charCurrentNum := substr(strYuanFen,1);    If charCurrentNum <> '0' Then      strRstFen := tabNumMapPing(charCurrentNum) || tabUnitMapPing(i) ||                   strRstFen;    End If;  End Loop;  If strRstYuan Is Not Null Then    strRstYuan := strRstYuan || '圆';  End If;  If strRstFen Is Null Then    strRstYuan := strRstYuan || '整';  Elsif length(strRstFen) = 2 And substr(strRstFen,2) = '角' Then    strRstFen := strRstFen || '整';  End If;  strRst := strRstYuan || strRstFen;  --strRst := Replace(strRst,'亿零','亿');  --strRst := Replace(strRst,'万零','万');  Return strRst;End Money2Chinese;

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的金额大写转小写SQL全部内容,希望文章能够帮你解决金额大写转小写SQL所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1164520.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存