Subject Re: [firebird-support] Procedure Problem, Div By 0
Author Olivier Rinaudo
perhaps you can use a 'secure div' user defined function
called for example 'sdiv' and then replace

ENH.TestedValue/ENL.TestedValue

by

sdiv(ENH.TestedValue,ENL.TestedValue)
...
i made one in delphi that i use with FB
don't know with IB5,5
let me know if you need



>I need some help, I keep getting an error of division by zero
>and I dont know how to get around it.
>
>I am trying to filter one table by comparing values of two different
>rows. If these values are more than 2 percent off they will be
>includes in the query. This query will indicate all of my bad
>failures, later I will mark these bad.
>
>I am using interbase 5.5
>
>Any help would be great
>Thank Andy
>
>Code Below
>
>
>CREATE PROCEDURE EACHNODE_NETLIST_2
>RETURNS (
> EHTESTEDVAL DOUBLE PRECISION,
> EHNODE INTEGER,
> EHSUB INTEGER,
> EHCIR INTEGER,
> ELTESTEDVAL DOUBLE PRECISION,
> ELNODE INTEGER,
> ELSUB INTEGER,
> ELCIR INTEGER)
>AS
>begin
> for
> select ENH.TestedValue,
> ENH.Node,
> ENH.SubstrateNum,
> ENH.CircuitNum,
> ENL.TestedValue,
> ENL.Node,
> ENL.SubstrateNum,
> ENL.CircuitNum
>
> From EachNode ENH, EachNode ENL
>
> Where
> (ENH.JobNum = "2621") and
> (ENH.ProberNum = 1) and
> (ENL.JobNum = "2621") and
> (ENL.ProberNum = 1) and
> ((ENH.Passed = 1) or (ENL.Passed = 1)) and
> (ENH.SubstrateNum = ENL.SubstrateNum ) and
> (ENH.CircuitNum = ENL.CircuitNum) and
> (ENH.Node = 2) and
> (ENL.Node = 92) and
> (
> ((ENH.TestedValue != 0) and (ENL.TestedValue != 0))
> and
> (
> ((ENH.TestedValue/ENL.TestedValue)>0 ) and
> ( (100 -((ENH.TestedValue/ENL.TestedValue)
> *100)) > (100 - 98))
> or(
> (ENL.TestedValue/ENH.TestedValue)>0 ) and
> ( (100 -((ENL.TestedValue/ENH.TestedValue)
> *100)) > (100 - 98))
> )
> )
>
>
>Into :EHTestedval, :EHNode, :EHSub, :EHCir, :ELTestedVal, :ELNode, :E
>LSub, :ELCir
>
> do suspend;
>end
>
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>
>