问题描述
最近在做db2 -> oracle迁移项目时,遇到了这种情况.开发人员无意中使用小数(s,p)列创建了新的表结构.我不记得 Oracle 支持这个,但后来一些挖掘表明它是一个 ANSI 数据类型,因此被 oracle 支持.
recently, while working on a db2 -> oracle migration project, we came across this situation. the developers were inadvertently creating new table structures using decimal(s,p) columns. I didn't remember Oracle supporting this, but then some digging showed that its a ANSI data type therefore supported by oracle.
然而,我的问题仍然存在 -
However, question for me remained -
- 内部如何处理这些数据?
- 使用 ANSI 类型而不是 Oracle 的内置类型是否有成本?
- 如果目标类型是Oracle内置类型,数据迁移过程中会不会有影响?
推荐答案
在 Oracle 中,它们是相同的:
In Oracle, they are the same:
创建表和簇的SQL语句也可以使用ANSI数据IBM 产品 SQL/DS 和 DB2 中的类型和数据类型.甲骨文识别与 Oracle 不同的 ANSI 或 IBM 数据类型名称数据库数据类型名称.它将数据类型转换为等效的Oracle 数据类型,将 Oracle 数据类型记录为列数据类型,以Oracle数据类型存储列数据基于下表中显示的转换.
SQL statements that create tables and clusters can also use ANSI data types and data types from the IBM products SQL/DS and DB2. Oracle recognizes the ANSI or IBM data type name that differs from the Oracle Database data type name. It converts the data type to the equivalent Oracle data type, records the Oracle data type as the name of the column data type, and stores the column data in the Oracle data type based on the conversions shown in the tables that follow.
此引用下方的表格显示 DECIMAL(p,s) 在内部被视为 NUMBER(p,s):
The table below this quote shows that DECIMAL(p,s) is treated internally as a NUMBER(p,s):
SQL> create table t (a decimal(*,5), b number (*, 5));
Table created
SQL> desc t;
Name Type Nullable Default Comments
---- ----------- -------- ------- --------
A NUMBER(*,5) Y
B NUMBER(*,5) Y
但是,DECIMAL 的比例默认为 0,这意味着 DECIMAL(*) 被视为 NUMBER(*, 0), 即 INTEGER:
However, the scale defaults to 0 for DECIMAL, which means that DECIMAL(*) is treated as NUMBER(*, 0), i.e. INTEGER:
SQL> create table t (a decimal, b number, c decimal (5), d decimal (5));
Table created
SQL> desc t;
Name Type Nullable Default Comments
---- --------- -------- ------- --------
A INTEGER Y
B NUMBER Y
C NUMBER(5) Y
D NUMBER(5) Y
这篇关于小数(s,p)还是数字(s,p)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)