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

查看:17
本文介绍了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.

推荐答案

我找到的最好的解释是:

the best explanation i've found is this:

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.

  • 整数(12.2) => 12
  • 整数(12.5) => 13
  • 整数(12.9) => 13
  • 整数(12.4) => 12
  • 数字(12.2) => 12.2
  • 数字(12.5) => 12.5
  • 数字(12.9) => 12.9
  • 数字(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天全站免登陆