FirebirdDB 无法运行程序,而其备份数据库可以
我的数据库遇到了问题,我使用 Firebird 1.5.3,它工作得很好,直到无法以正常方式读取或写入,但是当我运行程序时,我得到空白行结果和以下消息:
算术异常,数值 溢出或字符串截断。
SQL 代码:-802 IB 错误号: 335544321
所以我将它与一个月前的备份数据库进行了比较,它工作得很好,我得到了行数据。为了确保我的代码没有更改,我将这两个过程复制粘贴到 WinMerge(差异比较器)中,但没有什么不同。为了确保我的错误来自数据,我运行了旧日期交易(1 年前的数据)的程序,但我仍然收到这些消息。
我检查了程序中的算术逻辑,进行了修改,但没有成功。 有人可以帮忙解决这个问题吗?
谢谢一堆,
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,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过长时间跟踪代码和数据后,我发现了一个不知何故困扰我的障碍。主数据发生了变化,现在具有更长的字符(varchar)。在我的程序中,它被放入较小尺寸的 varchar 中,比如说 10 个字符。而新字符串大约为 15。这里出现错误...或字符串截断...。但无论如何,感谢您对我的问题的关注,感谢您写的线索,它以某种方式拯救了我,让我有了追踪它的想法。
谢谢一堆,
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,
具有完全相同数据的不同行为(在备份数据库和实时数据库中)是很奇怪的。也许其他一些过程或触发器弄乱了实时数据库中的查询。
既然你说你不能在这里发布代码,我会建议你可以尝试消除一些其他可能性。
“数字溢出或字符串截断。”是您收到的错误。
SUM()
或其他聚合函数?
如果上述任何一项为“是”,请尝试逐个删除任何此类部分,然后运行修改后的查询。因此您可能会发现查询的哪一部分产生了错误。
注意:由于
NOW()
和RAND()并不总是产生相同的结果代码>.如果这些函数的结果用于进一步的计算,则算术错误(例如除以 0 或溢出或其他类型的错误)可能会在一次运行中发生,而不会在另一次运行中发生。
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.
SUM()
or otheraggegate 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()
andRAND()
. 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.