Subject Re: [firebird-support] Division by zero chech
Author Jason Dodson
You need to check for conditions yourself in the first place. Take the following
statement for instance:

Insert Into MyTable (MyField1, MyField2) Values (Gen_ID(My_Generator, 1), 1/X);

If X = 0, then you will get an error. Instead, write it like this:

If (X = 0) Then
Insert Into MyTable (MyField1, MyField2) Values (Gen_ID(My_Generator, 1), NULL);
End Else Begin
Insert Into MyTable (MyField1, MyField2) Values (Gen_ID(My_Generator, 1), 1/X);

majstoru wrote:
> Hi,
> Does Firebird have a solution to check divizion by zero error?
> I have SP that update one table with some math operation with data
> from another table, when source table still have a records which will
> be generated divizion by zero, I cna't check this by SP code!
> Thanks

The information transmitted herewith is sensitive information intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.