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!

% Calculation -ORA-01476: "divisor is equal to zero"

zooba72Apr 20 2023

Hello Everyone,

I'm a newbie at SQL and need to calculate a %, but I'm struggling.

I was orginally getting an error ORA-01476: "divisor is equal to zero"

I used nullif to get past the error:

(lu._used / nullif(lu.total,0) * 100)

but I realized I need to sum used & total and then calculate the percentage - and I can't seem to figure it out:

(sum(lu.used) / nullif(sum(lu.total,0) * 100)

But I cotinue to get invalid number of agrguments - I've tried several variations. Does anyone have any suggestions how I can resolve this ?

Thank you in advance !

Comments
Post Details
Added on Apr 20 2023
2 comments
11,553 views