Subject Re: [firebird-support] division by zero
Author Jaimy Azle
On Thursday, March 18, 2004 3:26 PM Peter Lee wrote:

>
> We are getting 'Arithmatic overflow or division by zero has
> occurred. arithmetic exception, numeric overflow or string truncation'
> from the following query (running it through IBExpert, FB1.5).
>

You can use SELECT... CASE statement to evaluate
sum(g_stats.prac_attempted), eg:

SELECT ....,
CASE
WHEN (SUM(g_stats.prac_attempted) IS NULL) then 0
WHEN (SUM(g_stats.prac_attempted) = 0) then 0
ELSE SUM(g_stats.prac_correct) * 100 / SUM(g_stats.prac_attempted)
END
FROM ....

Salam,

-Jaimy