在Oracle中更改数字精度 [英] Changing the number precision in Oracle

查看:648
本文介绍了在Oracle中更改数字精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有看到这个确切的问题.如果我错过了,我深表歉意.

I haven't seen this exact issue... I apologize if I missed it.

我有一个数据库,他们从与我的公司失去合同时就创建了该数据库.现在,客户有一个紧急"问题来更改值的精度.他们希望将数字从10.3更改为10.8;该字段在数据库中定义为10,3.在我对该问题的研究中,似乎我必须做很多操作才能做到这一点,因为表需要为空才能更改精度.我假设即使默认值为10.38(或它的默认值),因为他们在创建时将其定义为10,3,如果我只是增加ColdFusion代码中的字段,则在保存时将其截断为10,3. ?所做的更改将涉及到我捕获当前数据,删除数据,更改精度,然后重新加载数据,确保现有数据也已更改.是的,我知道这不是详细信息,但希望能阐明这一点.谢谢.

I have a database I inherited from the company that created it when they lost the contract to my company. Now, the customer has an "urgent" issue to change the precision of a value. They want to change a number from 10.3 to 10.8; the field is defined in the database as 10,3. In my research of the issue, It seems I have to do quite a bit of manipulation to do this since the table needs to be empty to change the precision. I am assuming that even though the default is 10.38 (or whatever it is), since they defined it as 10,3 upon creation, if I just increase the field in the ColdFusion code, when it saves, it will truncate to 10,3? The change would involve me capturing the current data, deleting the data, changing the precision, then reloading the data, ensuring the existing data has been changed as well. Yes, I know that's not in detail, but hopefully gets the point across. Thank you.

推荐答案

您是否真的要从NUMBER(10,3)更改为NUMBER(10,8)?这将大大限制可以在字段中存储的数字范围-正是这就是为什么当列中有数据时您不能这样做的原因.

Do you really want to change from a NUMBER(10,3) to a NUMBER(10,8)? That would significantly restrict the range of numbers that could be stored in the field - which is precisely why you can't do it when there is data in the column.

或者您是说要将小数位数从3增加到8,同时仍允许相同的整体值范围?如果是这样,那么我认为您想将NUMBER(10,3)更改为NUMBER(15,8)-即使该列包含数据,您也应该能够使用简单的ALTER来做到这一点.

Or do you mean that you want to increase the number of decimal places from 3 to 8, while still allowing the same overall range of values? If so, then I think you want to change NUMBER(10,3) to NUMBER(15,8) - and you should be able to do that using a simple ALTER even if the column contains data.

这篇关于在Oracle中更改数字精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆