Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dividing multiple counts

886466Sep 9 2011 — edited Sep 10 2011
Hello everyone,

I am trying to divide one count by another. I have pasted the part of the query I am struggling with below (sorry about the confusing aliases).

 
count(distinct p.processno)/(select COUNT(distinct oa.noteid) as "Count" 
from W2PROCESSdch Pab, upmfolder fab, w2objectnote oa, w2processtype ptab, w2stage sab 
where fab.folderid = pab.keynumb 
and trunc(Pab.STAGESTARTDATE) >=  '07-SEP-11' 
and trunc(Pab.STAGESTARTDATE) <= '07-SEP-11' 
and pab.processname = ptab.proctypeid 
and sab.stageid = pab.stageid 
and oa.keynumb = pab.processno 
and oa.notetype = 'RN' 
and trunc(oa.ndate) = TRUNC(Pab.STAGESTARTDATE) 
and UPPER(sab.caption) like UPPER('View Rejection%') 
and p.userid = pab.userid)* 100 
Unfortunately I get the error "01476. 00000 - "divisor is equal to zero"".

I have tried using CASE but that isn't working either.

I have tried searching for the solution but I have had no luck. If anyone could suggest how I should structure this part of the query I would be extremely grateful.
This post has been answered by Kim Berg Hansen on Sep 9 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2011
Added on Sep 9 2011
8 comments
663 views