在这种情况下,我有一个“除以”。如何修改此值以通过零错误处理div?
CASE WHEN INVOICE_V.INVC_TYPE = 0 then
(((INVC_ITEM_V.PRICE - INVC_ITEM_V.TAX_AMT)*INVC_ITEM_V.QTY) -
(INVC_ITEM_V.COST * INVC_ITEM_V.QTY))
/ ((INVC_ITEM_V.PRICE - INVC_ITEM_V.TAX_AMT)*INVC_ITEM_V.QTY)*100
else 0 END as EXT_M_PERCENT,
答案 0 :(得分:1)
如果用“句柄”表示返回0,则可以这样做:
CASE WHEN INVOICE_V.INVC_TYPE = 0
AND (((INVC_ITEM_V.PRICE - INVC_ITEM_V.TAX_AMT)*INVC_ITEM_V.QTY) <> 0 THEN