Subject | Weird Integer Overflow |
---|---|
Author | James |
Post date | 2003-12-19T00:38:18Z |
Hi when I execute this sql query
select (("TotalAmount" * (1-("Discount"*0.01)) * (1-("Discount2"*0.01))
* (1-("Discount3"*0.01)) - "Less" - "Adjustment")) as "GrandTotal"
from "invoice"
Iam getting a Interger Overflow error. The result of an integer
operation cause the most significant bit of the result to carry. But I
don't have any integer field here ... All of them are Numerics(15,2)
expcept for the discounts field which are numerics(4,2)
Hint:
1. I limit the number of records to be included with "where
"TotalAmount" < 100000" and everything works well. I have a
"TotalAmount" = 560000 as the biggest value.
2. I have try this sql and it works on all records
select "TotalAmount"* (1-("Discount"*0.01)) * (1-("Discount2"*0.01))
from "invoice"
or
select "TotalAmount"* (1-("Discount2"*0.01)) * (1-("Discount3"*0.01))
from "invoice"
What is this error?
James
select (("TotalAmount" * (1-("Discount"*0.01)) * (1-("Discount2"*0.01))
* (1-("Discount3"*0.01)) - "Less" - "Adjustment")) as "GrandTotal"
from "invoice"
Iam getting a Interger Overflow error. The result of an integer
operation cause the most significant bit of the result to carry. But I
don't have any integer field here ... All of them are Numerics(15,2)
expcept for the discounts field which are numerics(4,2)
Hint:
1. I limit the number of records to be included with "where
"TotalAmount" < 100000" and everything works well. I have a
"TotalAmount" = 560000 as the biggest value.
2. I have try this sql and it works on all records
select "TotalAmount"* (1-("Discount"*0.01)) * (1-("Discount2"*0.01))
from "invoice"
or
select "TotalAmount"* (1-("Discount2"*0.01)) * (1-("Discount3"*0.01))
from "invoice"
What is this error?
James