Subject Re: [firebird-support] "divison by 0" question
Author Martijn Tonies
Hi,

> I have a query that looks something like:
> SELECT
> S.PRICE SALEPRICE,
> E.PRICE ENTRYPRICE,
> (S.PRICE -I.PRICE)/I.PRICE PERCENT
> FROM SALES S, ENTRYS E
> WHERE S.IDENTRY = E.ID
>
> The problem is that I.PRICE can be 0 and i get a division by 0 error. Is
> there a way to make PERCENT = 100 if I.PRICE = 0 without running two
querys?

You could try with COALESCE. Check the Firebird 1.5 release notes
for the syntax.

Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com