oracle to db2 data type: asterisk in number precision
I am converting an existing oracle SQL query to DB2 - I wanted to know what does the oracle construct:
COLUMN1_ NUMBER(*,10)
...would mean in DB2...
COLUMN1_
is the column name in the开发者_运维知识库 table.
I did some digging and found this:
Oracle guarantees portability of numbers with a precision equal to or less than 38 digits. You can specify a scale and no precision:
column_name NUMBER (*, scale)
In this case, the precision is 38, and the specified scale is maintained.
from here: http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/datatype.htm#i22289
Though I have not found what it will mean interms of DB2 create table query.
Any inputs?
You can replace NUMBER(x, y) with DECIMAL(x, y) or enable compatibility features and leave it as is.
I didn't know you could use an asterisk so I created a table with that column specification. In Oracle 10.2 it's the same as
NUMBER(22, 10)
or DECIMAL(22, 10)
.
The first number (22) is maximum number of significant digits allowed. The second number (10) is the maximum number of digits to the right of the decimal place.
Starting with release 9.7, DB2 for Linux, UNIX, and Windows now supports a wide variety of Oracle functions, data types (NUMBER, VARCHAR2, DATE that includes a timestamp, to name a few), and also introduces PL/SQL compatibility. The goal of these features is to help accelerate and simplify the task of migrating applications from Oracle to DB2. IBM even provides a compatibility analysis tool called MEET DB2 that will scan an extract of your Oracle DDL (including PL/SQL packages) to produce a report that highlights the areas that may require some manual adjustment to work in DB2. When the DB2_COMPATIBILITY_VECTOR is set to ORA, it is not uncommon for over 90% of the original Oracle code to function properly as-is.
精彩评论