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: Mark C. Stock <mcstockX_at_Xenquery>
Date: Fri, 3 Feb 2006 08:26:04 -0500
Message-ID: <CI6dnaJjPe9yxH7enZ2dnUVZ_tGdnZ2d@comcast.com>

<mjbox01_at_gmail.com> wrote in message
news:1138971933.356881.55030_at_g43g2000cwa.googlegroups.com...
>
> Mark C. Stock wrote:
>
>> you'll need to use a CASE expression to convert a 0 divisor to 1 to
>> avoide
>> the ORA-01476
>
> I see this a lot and I have never understood it, as it will return
> essentially random data, e.g.
>
> 20/2 will be equal to 10/0 which it obviously is not.
>
> And what is the fear of null, if you have a null return it don't put
> some random value in there. I would argue that n/0 should be returned
> as null or 'NA'. In which case the select should simply be
>
> select case when on_duty <> then
> to_char(production / on_duty * 100) || '%'
> end,
>
> or
>
> select case when on_duty <> then
> to_char(production / on_duty * 100) || '%'
> else
> 'NA'
> end,
>

point made.

no fear of null (no reason to assert that, either) -- i was just having vague recollections of other situations where substituting 1 for zero made sense

the value used instead of null (or the use of null itself) should depend on the definition of the required results

++ mcs Received on Fri Feb 03 2006 - 07:26:04 CST

Original text of this message

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