Solved

Interbase / FIrebird Error on SUM()

Posted on 2010-09-09
7
753 Views
Last Modified: 2012-06-21
i got error likethis when im trying to sum an ammount on sales

Arithmetic exception, numeric overflow, or string truncation
Statement: select sum(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31'

Can anybody help for this error
0
Comment
Question by:mucicid
7 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 33634225
the number sum(sales) may be too big

possible a very big number got into the system causing the overflow
find it like this:

select max(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31'

or

select sales
from tkt_tiket
where sdate >= '2009-01-01' and sdate <= '2009-01-31'
order by sales desc
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 33634231
do you get this same error if you do it from the ib console ?

or just in delphi ?
0
 

Author Comment

by:mucicid
ID: 33634427
i got the error from ib console and sql explorer. im using C# for the app i havent tried on delphi, on C# app it works well.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 33634677
have you checked the values in the db for sales ?
0
 
LVL 4

Expert Comment

by:bjove
ID: 33637139
What type is sdate field?
0
 
LVL 19

Accepted Solution

by:
NickUpson earned 500 total points
ID: 33644446
Please try this and see if it solves the problem

select sum(sales) from tkt_tiket where sdate >= '2009-01-01' and sdate <= '2009-01-31' and sales is not null
0
 

Author Closing Comment

by:mucicid
ID: 34016960
thx. sory for too long
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question