oracle report summary column error -

I get an error- divisor is equal to zero.

The code is
------------------
function CF_4Formula return Number is
begin
  return(:cs_1/:cs_sites);
end;
screen-print.JPG
LVL 6
anumosesAsked:
Who is Participating?
 
slightwv (䄆 Netminder) Commented:
My forms code is old.

Can you use CASE?

return(:cs_1/case :cs_sites when 0 then 1 else :cs_sites end)

worst case, can you use if?

function CF_4Formula return Number is
    temp_num number;
begin
     if :cs_sites = 0 then
        temp_num := 1;
    else
       temp_num := :cs_sites;
   end if;
  return(:cs_1/temp_num);
end;
0
 
slightwv (䄆 Netminder) Commented:
and?  cs_sites must be zero.

What do you want to be the result it cs_sites is 0?  you can return cs_1 with something like:

return(:cs_1/decode(cs_sites,0,1,cs_sites))
0
 
anumosesAuthor Commented:
We cannot use decode in reports function. I had tried earlier
screen.JPG
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
slightwv (䄆 Netminder) Commented:
Again though, you never answered what you want the result to be?

If you want say -1 or -999 returned, that is different logic.
0
 
anumosesAuthor Commented:
never negative value. Its either 0 or > 0
0
 
slightwv (䄆 Netminder) Commented:
>>never negative value. Its either 0 or > 0

you misunderstaood what I said:  If cs_sites is ZERO, what value do you want returned from the function?
0
 
anumosesAuthor Commented:
thanks
0
 
anumosesAuthor Commented:
Oh ok I want to return 0
0
 
slightwv (䄆 Netminder) Commented:
>>Oh ok I want to return 0

function CF_4Formula return Number is
begin
     if :cs_sites = 0 then
        return(0)
    else
        return(:cs_1/:cs_sites);
    end if;
end;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.