异构关系数据库(MySql与Oracle)之间的数据类型转换参考
一、MySQL到Oracle的数据类型的转变:
编号 |
MySQL |
ToOracle |
Oracle |
1 |
GEOMETRY |
BLOB |
BLOB |
2 |
GEOMETRYCOLLECTION |
BLOB |
BLOB |
3 |
MULTILINESTRING |
BLOB |
BLOB |
4 |
LINESTRING |
BLOB |
BLOB |
5 |
MULTIPOINT |
BLOB |
BLOB |
6 |
MULTIPOLYGON |
BLOB |
BLOB |
7 |
POINT |
BLOB |
BLOB |
8 |
POLYGON |
BLOB |
BLOB |
9 |
DECIMAL |
INTEGER |
Number |
10 |
DECIMAL(10) |
INTEGER |
Number |
11 |
BLOB |
VARCHAR2(2000) |
BLOB |
12 |
BLOB(10) |
VARCHAR2(2000) |
BLOB |
13 |
LONGBLOB |
VARCHAR2(2000) |
BLOB |
14 |
MEDIUMBLOB |
VARCHAR2(2000) |
BLOB |
15 |
TINYBLOB |
VARCHAR2(2000) |
BLOB |
16 |
BINARY(10) |
BLOB |
RAW |
17 |
VARBINARY(10) |
VARCHAR2(2000) |
RAW |
18 |
YEAR |
DATE |
NUMBER(3,0) |
19 |
DOUBLE |
NUMBER |
BINARY_DOUBLE(NUMBER也可以) |
20 |
FLOAT |
NUMBER |
BINARY_FLOAT(NUMBER也可以) |
21 |
CHAR(2) |
VARCHAR2(2) |
CHAR |
22 |
NVARCHAR(10) |
VARCHAR2(10) |
NVARCHAR |
23 |
TEXT(10)(建表后成为TINYTEXT) |
VARCHAR2(85) |
CLOB |
24 |
REAL(生成表后成为Double) |
NUMBER |
NUMBER |
25 |
BIT |
VARCHAR2(2000) |
RAW |
26 |
ENUM('test1','test2') |
VARCHAR2(5) |
VARCHAR2 |
27 |
SET('test1','test2') |
VARCHAR2(11) |
VARCHAR2 |
28 |
INT |
INTEGER |
NUMBER |
29 |
TIMESTAMP |
DATE |
TIMESTAMP |
30 |
BIGINT |
INTEGER |
NUMBER |
31 |
INT(8) |
INTEGER |
NUMBER |
32 |
MEDIUMINI(10) |
INTEGER |
NUMBER |
33 |
SMALLINT(2) |
INTEGER |
NUMBER |
34 |
TINYINT |
INTEGER |
NUMBER |
35 |
TINYTEXT |
VARCHAR2(85) |
CLOB |
36 |
VARCHAR |
VARCHAR |
VARCHAR |
38 |
DATE |
DATE |
DATE |
39 |
DATETIME |
DATETIME |
DATETIME |
40 |
TIME |
DATE |
VARCHAR |
41 |
LONGTEXT |
CLOB |
CLOB |
42 |
MEDIUMTEXT |
CLOB |
CLOB |
二、Oracle到MySQL的数据类型的转变
编号 |
Oracle |
ToMySQL |
MySQL |
1 |
BINARY_DOUBLE |
TINYTEXT |
DOUBLE |
2 |
BINARY_FLOAT |
TINYTEXT |
FLOAT |
3 |
BLOB |
LONGBLOB |
BLOB |
4 |
CHAR |
VARCHAR(2) |
CHAR |
5 |
DATE |
UNKNOWN |
DATE |
6 |
INTERVAL DAY TOSECOND |
TINYTEXT |
TINYTEXT |
7 |
INTERVAL YEAR TO MONTH |
TINYTEXT |
TINYTEXT |
8 |
NUMBER |
DOUBLE |
NUMBER |
9 |
NVARCHAR2 |
VARCHAR(20) |
NVARCHAR2 |
10 |
RAW |
VARCHAR(20) |
|
11 |
TIMESTAMP |
UNKNOWN |
DATETIME |
12 |
TIMESTAMP(6) WITH LOCAL TIME ZONE |
TINYTEXT |
TINYTEXT |
13 |
TIMESTAMP(6) WITH TIME ZONE |
TINYTEXT |
TINYTEXT |
14 |
CLOB |
MEDIUMTEXT |
MEDIUMTEXT |
15 |
LONG |
TINYTEXT |
TINYTEXT |
16 |
NCLOB |
MEDIUMTEXT |
MEDIUMTEXT |
17 |
VARCHAR2 |
VARCHAR2 |
VARCHAR2 |