Subject division by zero
Author Peter Lee
Hello Everybody,

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).

We are fairly sure that one of the divisions for prac_percent and
test_percent are causing the problem. Is there any way to get around this
if the sum(g_stats.prac_attempted) or sum(g_stats.test_attempted) are zero?

I haven't bothered posting the entire query, but am happy to do so if need be!


Peter Lee


SELECT g_user.login_name,,
sum(g_stats.prac_correct) as prac_correct,
sum(g_stats.prac_attempted) as prac_attempted,
sum(g_stats.test_correct) as test_correct,
sum(g_stats.test_attempted) as test_attempted,
sum(g_stats.prac_correct) * 100 / sum(g_stats.prac_attempted) AS
sum(g_stats.test_correct) * 100 / sum(g_stats.test_attempted) AS

Peter Lee Mobile: +61 412 011 174 ptle@...
Rising Software Australia Pty. Ltd.
Publishers of 'Auralia' - Ear Training and 'Musition' - Theory Training
Ph: +61 3 9481 3320 FAX: +61 3 9481 3380 USA Freecall: 1 888 667 7839