Oracle字典视图中数字和整数数据类型之间的区别 [英] Difference between number and integer datatype in oracle dictionary views

查看:402
本文介绍了Oracle字典视图中数字和整数数据类型之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用oracle词典视图来找出两个模式之间的列差异(如果有).在同步数据类型差异时,我发现存储在all_tab_columns/user_tab_columns/dba_tab_columns中的NUMBER和INTEGER数据类型仅以NUMBER形式存储,因此很难同步其中一个模式/列具有数字数据类型而另一个模式/列具有整数数据类型的数据类型差异.

I used oracle dictionary views to find out column differences if any between two schema's. While syncing data type discrepancies I found that both NUMBER and INTEGER data types stored in all_tab_columns/user_tab_columns/dba_tab_columns as NUMBER only so it is difficult to sync data type discrepancies where one schema/column has number datatype and another schema/column has integer data type.

在比较架构时,它显示数据类型不匹配.请建议是否还有其他使用字典视图的替代形式,或者是否可以使用字典视图中的任何特定属性来标识数据类型是否为整数.

While comparison of schema's it show datatype mismatch. Please suggest if there is any other alternative apart form using dictionary views or if any specific properties from dictionary views can be used to identify if data type is integer.

推荐答案

我发现的最佳解释是:

INTEGER和NUMBER有什么区别?什么时候应该使用NUMBER?什么时候应该使用INTEGER?我只是想在这里更新我的评论...

What is the difference betwen INTEGER and NUMBER? When should we use NUMBER and when should we use INTEGER? I just wanted to update my comments here...

NUMBER总是按我们输入的方式存储.范围是-84到127.但是INTEGER会四舍五入为整数. INTEGER的小数位数为0.INTEGER等于NUMBER(38,0).这意味着,INTEGER是受限制的数字.小数点后一位将四舍五入.但是NUMBER不受限制.

NUMBER always stores as we entered. Scale is -84 to 127. But INTEGER rounds to whole number. The scale for INTEGER is 0. INTEGER is equivalent to NUMBER(38,0). It means, INTEGER is constrained number. The decimal place will be rounded. But NUMBER is not constrained.

  • INTEGER(12.2)=> 12
  • INTEGER(12.5)=> 13
  • INTEGER(12.9)=> 13
  • INTEGER(12.4)=> 12
  • NUMBER(12.2)=> 12.2
  • NUMBER(12.5)=> 12.5
  • NUMBER(12.9)=> 12.9
  • NUMBER(12.4)=> 12.4

INTEGER总是比NUMBER慢.由于整数是具有附加约束的数字.要花费更多的CPU周期来实施约束.我从来没有看到任何区别,但是当我们在INTEGER列上加载数百万条记录时,可能会有区别.如果需要确保输入为整数,则最好选择INTEGER.否则,我们可以坚持使用NUMBER数据类型.

INTEGER is always slower then NUMBER. Since integer is a number with added constraint. It takes additional CPU cycles to enforce the constraint. I never watched any difference, but there might be a difference when we load several millions of records on the INTEGER column. If we need to ensure that the input is whole numbers, then INTEGER is best option to go. Otherwise, we can stick with NUMBER data type.

这是链接

这篇关于Oracle字典视图中数字和整数数据类型之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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