select a.RECEIPTDTLUUID as receiptdtluuid,'0' as planqty
case when NVL(a.qty,0)-NVL(a.TOTALREALQTY,0)-NVL(b.totalPlanQty,0)<= 0 then 0 else NVL(a.qty,0)-NVL(a.TOTALREALQTY,0)-NVL(b.totalPlanQty,0) end PlanQty
from B_PS_RECEIPTDTL a
inner join B_PS_RECEIPT c on a.RECEIPTUUID=c.RECEIPTUUID
left join (
select a.SOURCEBILLDTLUUID,sum(a.quantity) totalPlanQty
from B_ST_IOSTORINVDTL a
inner join B_ST_IOSTORINVMST b on a.IOSTORINVUUID=b.IOSTORINVUUID
inner join B_PS_RECEIPTDTL c on c.RECEIPTDTLUUID=a.SOURCEBILLDTLUUID
inner join B_PS_RECEIPT d on c.RECEIPTUUID=d.RECEIPTUUID
and b.BILLSTATUS < 70
and d.BILLCODE= ''
GROUP BY a.SOURCEBILLDTLUUID
)b ON a.RECEIPTDTLUUID=b.SOURCEBILLDTLUUID
where c.BILLCODE= '';
这是在数据库中能正常运行的sql,但是当放到xml文件里的时候,项目启动无法正常启动,数据库连接失败,后来才发现xml文件里对sql语句有很多限制条件
case when NVL(a.qty,0)-NVL(a.TOTALREALQTY,0)-NVL(b.totalPlanQty,0)<= 0 then 0 else NVL(a.qty,0)-
and b.BILLSTATUS < 70
xml文件是无法对小于号进行解析的可以应 <
代替。
and b.BILLSTATUS < 70
同样这里不能直接进行比较需要利用
<![CDATA[ and b.BILLSTATUS < 70 ]]>