Question

I had a trouble in my database here, I use Firebird 1.5.3 and it work just fine until noe to read or write in normal way, but when I run a procedure, I got blank row result and the following message :

Arithmetic exception, numeric overflow, or string truncation.

SQL Code: -802 IB Error Number: 335544321

So I compared it with my backup db a month ago, it worked just fine, I get data in rows. To ensure my code wasnt change, I copy paste both procedure in WinMerge (diff comparer) but nothing diffrent. To ensure my error came from data, I run my procedure for old dated transaction (1 year old data), still I get those message.

I check the aritmethic logic in procedure, modifying, but no luck. Did anyone can help with this?

Thx a bunch,

Was it helpful?

Solution

After a long tracing into the code and data, I found the obstacle which somehow bugging me out. There was a change in a master data which now has longger character (varchar). In my procedure it was put into a smaller size of varchar, let say 10 character. While new string its about 15. Here goes the error ...or string truncation..... But anyway thanks of your attention to my problem and thanks for the clues you wrote, it save me somehow, give me the idea to trace it up.

Thx a bunch,

OTHER TIPS

Different behaviour (in backup db and live one) with exactly same data is strange. Perhaps some other procedure or trigger is messing up with your query in the live db.

Since you say that you can't publish the code here, I'll suggest something you can try to eliminate some other possibilities.

"numeric overflow, or string truncation." is the error you get.

  • Does the query have SUM() or other aggegate function?
  • Does it have any string manipulating function?

If yes on any of the above, try to remove any such part, one by one, and run the modified query. So you may spot which part of the query produces the error.


Note: Same db structure, same data and same query do not always produce same results because of non-deterministic functions like NOW() and RAND(). If the results of these functions are used in further computations, then arithmetic errors like division by 0 or overflow or other types of errors can occur in one run and not in another.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top