Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Attempting to get Result as "%"

Re: Attempting to get Result as "%"

From: Ben de Boer <cbdeboer_at_planet.nl>
Date: Fri, 3 Feb 2006 13:04:55 +0100
Message-ID: <drvgt9$6qo6$1@news3.infoave.net>


Mark,
NVL(SUM(ON_DUTY),0) is causing ORA-01476: divisor is equal to zero when you do NVL(SUM(PRODUCTION),0)/SUM(ON_DUTY) then this answer is NULL and will not give an error.

The percentage seems to be round(result * 100,2) With a percetage added : to_char(round(result * 100,2))||' %'

Regards,
Ben de Boer

"MSWEENEY" <MSWEENEY01_at_ADELPHIA.NET> wrote in message news:1138965754.809281.198490_at_z14g2000cwz.googlegroups.com...
> I am very much a beginner at SQL and use iSQL primarily. I have a
> fairly simple query and which performs a SUM function whereby one
> number is divided by another. I would like the answer to be provided
> as a percentage as opposed to a decimal.
>
> example:
>
> ((NVL(SUM(PRODUCTION),0)/NVL(SUM(ON_DUTY),0))-1) AS UTILIZATION
>
> PRODUCTION - 69
> ON_DUTY - 120
>
> UTILIZATION RESPONSE: 0.575
>
> DESIRED RESPONSE: 57.5%
>
> Also, I get the following error and only certain records are reported:
>
> ERROR:
> ORA-01476: divisor is equal to zero
>
> Any help is greatly appreciated!
>
> Mark
>
Received on Fri Feb 03 2006 - 06:04:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US