# oracle中数字保留几位小数的问题

2018/03/06 20:01

需求:#将数字填充到对应金额单中
select substr(b.payMoney,length(b.payMoney),1) 分,
substr(b.payMoney,length(b.payMoney)-1,1) 角,
case when length(b.payMoney)-3 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-3,1)
end 圆,
case when length(b.payMoney)-4 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-4,1)
end 拾,
case when length(b.payMoney)-5 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-5,1)
end 百,
case when length(b.payMoney)-6 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-6,1)
end 千,
case when length(b.payMoney)-7 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-7,1)
end 万,
case when length(b.payMoney)-8 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-8,1)
end 十万,
case when length(b.payMoney)-9 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-9,1)
end 百万,
case when length(b.payMoney)-10 <=0 then ''
e end 亿
from dual;
lse substr(b.payMoney,length(b.payMoney)-10,1)
end 千万,
case when length(b.payMoney)-11 <=0 then ''
else substr(b.payMoney,length(b.payMoney)-11,1)

0 评论
0 收藏
0