首页 > 数据库 > Oracle > ORA-01476的异常
主要就是在ORACLE中进行除的时候出现了除数为0.所以应该做的就是。避免出现这样的情况。就使用函数。
decode(t.person_no,0,null,a.count_uid /t.person_no ) 可以避免
select round (decode(t.person_no,0,null,a.count_uid /t.person_no ),2), t.unit_id
from (select count(tg.unit_id) count_uid, tg.unit_id
from t_group_info tg, t_alarm_allmember ta
where tg.unit_id = ta.unit_code
and tg.be_policy_type = 'AB'
group by tg.unit_id) a,
t_group_info t
where t.be_policy_type = 'AB'
and a.unit_id= t.unit_id
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22787229/viewspace-1028322/ ,如需转载,请注明出处,否则将追究法律责任。