Subject Procedure Problem, Div By 0
Author andyh20012003
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