Solved

Interbase / FIrebird Error on SUM()

Posted on 2010-09-09
7
761 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Read about achieving the basic levels of HRIS security in the workplace.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

687 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