Link to home
Start Free TrialLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

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
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

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))
Avatar of anumoses

ASKER

We cannot use decode in reports function. I had tried earlier
screen.JPG
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Again though, you never answered what you want the result to be?

If you want say -1 or -999 returned, that is different logic.
never negative value. Its either 0 or > 0
>>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?
thanks
Oh ok I want to return 0
>>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;