Subject | Re: [firebird-support] Division by zero chech |
---|---|
Author | Walter Ogston |
Post date | 2005-12-29T15:18:31Z |
Just to fill out what Lester says, here is a snippet of sql that does what
you want:
select
<other stuff>
case
when sum(A.UIDCOUNT) is not null and sum(A.UIDCOUNT) <> 0 then
(select
100 * cast(count(C.UID) as double precision) from
actcount C
where C.COLLECTION_NUMBER = B.COLLECTION_NUMBER
and C.OPERISD = A.OPERISD)/ sum(A.UIDCOUNT)
else null
end PERCENT
<from etc.>
At 03:54 AM 12/29/2005, you wrote:
C. Walter Ogston
ogstoncw@...
*/
you want:
select
<other stuff>
case
when sum(A.UIDCOUNT) is not null and sum(A.UIDCOUNT) <> 0 then
(select
100 * cast(count(C.UID) as double precision) from
actcount C
where C.COLLECTION_NUMBER = B.COLLECTION_NUMBER
and C.OPERISD = A.OPERISD)/ sum(A.UIDCOUNT)
else null
end PERCENT
<from etc.>
At 03:54 AM 12/29/2005, you wrote:
>majstoru wrote:/*
>
> > Hi,
> >
> > Does Firebird have a solution to check divizion by zero error?
> > I have SP that update one table with some math operation with data
> > from another table, when source table still have a records which will
> > be generated divizion by zero, I cna't check this by SP code!
>
>Just don't generate the divide by zero?
>Check the divisor is not zero before using it, and produce a different
>value to insert?
>
>--
>Lester Caine
>-----------------------------
>L.S.Caine Electronic Services
>Treasurer - Firebird Foundation Inc.
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit <http://firebird.sourceforge.net>http://firebird.sourceforge.net and
>click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at
><http://www.ibphoenix.com>http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>
>
>SPONSORED LINKS
><http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw>Technical
>support
><http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA>Computer
>technical support
><http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjEqA6g>Compaq
>computer technical support
><http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w>Compaq
>technical support
><http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfmvLcA>Hewlett
>packard technical support
><http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw>Microsoft
>technical support
>
>
>----------
>YAHOO! GROUPS LINKS
>
> * Visit your group
> "<http://groups.yahoo.com/group/firebird-support>firebird-support" on the web.
> *
> * To unsubscribe from this group, send an email to:
> *
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>firebird-support-unsubscribe@yahoogroups.com
>
> *
> * Your use of Yahoo! Groups is subject to the
> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>
>
>----------
C. Walter Ogston
ogstoncw@...
*/