• SQL0419N 十进制除法运算无效,因为结果将有一个负小数位。 SQLSTATE=42911


    select case when sum(qty_sold*u.um03/u.um08) <> 0 then
    decimal(coalesce(sum(d.amt_sold_with_tax)/sum(qty_sold*u.um03/u.um08),0), 18, 2)
    else 0 end as value
    from item_saleorg_day_2019 d
    left join rpt_item_um u on d.item_id = u.item_id
    left join dim_item i on d.item_id = i.item_id
    where d.date1 between '20190101' and '20190106'

    出现下面的错误:

     SQL0419N  十进制除法运算无效,因为结果将有一个负小数位。  SQLSTATE=42911

    SQL改为下面就可以了:

    select case when sum(qty_sold*u.um03/u.um08) <> 0 then
    decimal(coalesce(sum(d.amt_sold_with_tax)/dec(sum(qty_sold*u.um03/u.um08),30,2),0), 18, 2)
    else 0 end as value
    from item_saleorg_day_2019 d
    left join rpt_item_um u on d.item_id = u.item_id
    left join dim_item i on d.item_id = i.item_id
    where d.date1 between '20190101' and '20190106'

  • 相关阅读:
    BUUCTF-RE-frimware
    BUUCTF-RE-pyre
    BUUCTF-RE-红帽2019easyRE
    BUUCTF-RE-Youngter-drive
    BUUCTF-RE-LuckGuy
    BUUCTF-RE-简单注册器
    BUUCTF-RE-8086
    BUUCTF-RE-CrackRTF
    PWN学习 ---- pwnable ----input
    linux 远程文件传输
  • 原文地址:https://www.cnblogs.com/zmc/p/10231258.html
Copyright © 2020-2023  润新知