感谢您阅读我的问题。
我有以下查询。
round(count(product)*100/(select sum(count(product)) FROM FACTORY
WHERE TRUNC(COMPLETED) >= '01-MAR-2013' and
TRUNC(COMPLETED) <= '31-MAR-2013'
group by (product))) as percentage FROM FACTORY
我收到以下错误。
Error: ORA-01476: divisor is equal to zero
SQLState: 22012
ErrorCode: 1476
我试图把 COALESCE 但仍然得到同样的错误。
round(count(product)*100/(select COALESCE(sum(count(product)),0) FROM FACTORY
WHERE TRUNC(COMPLETED) >= '01-MAR-2013' and
TRUNC(COMPLETED) <= '31-MAR-2013'
group by (product))) as percentage FROM FACTORY
请帮忙。