Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:13:45+00:00 2026-06-15T12:13:45+00:00

I have previously asked the following question: Calculating percentage within the SQL Now i

  • 0

I have previously asked the following question: Calculating percentage within the SQL

Now i was lucky enough to get a great answer however in my question i did not take into account that my rows could contain zero.

The questions row where simple:

select 
Number_of_Calls,
Number_of_Answered,
((Number_of_answered/Number_Of_Calls)*100) as answer_percent,
Date
from table Where Date BETWEEN '2012-09-10' AND '2012-09-11'

However Number_of_answered could be zero (if our company did not answer the calls) so if i want the full number in percentage how do i take 0 into account?

By the way. The database that we use is an Oracle database with PL SQL

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:13:46+00:00Added an answer on June 15, 2026 at 12:13 pm

    The nullif function can be used to return null if the divisor is zero. When SQL encounters a null divisor it forces the entire equation to return null, preventing your error from occurring.

    select 
    Number_of_Calls,
    Number_of_Answered,
    ((Number_of_answered/nullif(Number_Of_Calls,0))*100) as answer_percent,
    Date
    from table Where Date BETWEEN '2012-09-10' AND '2012-09-11'
    

    If you would like to exclude null percentages use the following SQL:

    select * from(select 
        Number_of_Calls,
        Number_of_Answered,
        ((Number_of_answered/nullif(Number_Of_Calls,0))*100) as answer_percent,
        Date
        from table Where Date BETWEEN '2012-09-10' AND '2012-09-11') alias
    where answer_percent is not null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Previously I've asked about inserting a column into a dataset . I now have
I have asked a similar question previously but it was never resolved so here
I have previously solved a similar problem in this question , where I asked
Sorry if this is a repeat of a question asked previously, but I have
I have previously asked two questions Question 1 and Question 2 but there is
I previously asked a question about a delphi and a C/C++ DLL. I have
I previously asked the question Get all files and directories in specific path fast
this is a follow on question to a previously asked question . I have
I had previously asked this question, trying to get started with this code: The
This is a related to a previous question I have asked here, see the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.