【问题】
SQL:
select XH,ZBMC,ZBBZMS,SJZ,ABS(SJZ-ZBBZZ) BZBZCY from (
select X.XH,X.ZBMC,X.ZBBZMS,X.ZBBZZ,
(case when XH=1 then (XM1-XM2)/XM3
when XH=2 then (XM4-XM5)/XM6
when XH=3 then (XM7-XM8)/XM9
when XH=4 then (XM10-XM11)/XM12
when XH=5 then XM13/XM14
when XH=6 then (XM15+XM16+XM17)/(XM18+XM19+XM20)
when XH=7 then XM21/XM22
when XH=8 then XM23/XM24
when XH=9 then XM25/XM26
when XH=10 then XM27/XM28
when XH=11 then (XM29-XM30)/XM31
when XH=12 then XM32/(XM33-XM34)
when XH=13 then XM35/XM36*XM37
when XH=14 then (XM38-XM39)/XM40
when XH=15 then XM41/XM42
when XH=16 then (XM43-XM44)/XM43
when XH=17 then XM45/XM46
when XH=18 then XM47/XM48
when XH=19 then XM49/XM50
when XH=20 then XM51/XM52
when XH=21 then XM53/XM54
end) SJZ from JGZBXM X left join JGZBSJ S on S.YF=:TJYF
)
pl/sql developer执行SQL时没有问题
在C#程序里确报算术运算导致溢出。
【分析】
1、排除数据为0的原因
2、百度后 Oracle的精度和C#之间的精度是不一致的
【结论】
涉及到“除”的SQL语句语句的时候,都可用用round来把精度降低 。