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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.