Whenever you work Database design, Database Migration, You should
be aware about data type, Storage required by data type. Whenever you work on migration, you should
know the equivalent data type between existing definitions.
Below is the quick comparison of Oracle Data type with MySQL
Data type.
Default Data Type Mappings
MySQL
Data Type
|
Oracle
Data Type
|
BIGINT
|
NUMBER(19,
0)
|
BIT
|
RAW
|
BLOB
|
BLOB,
RAW
|
CHAR
|
CHAR
|
DATE
|
DATE
|
DATETIME
|
DATE
|
DECIMAL
|
FLOAT
(24)
|
DOUBLE
|
FLOAT
(24)
|
DOUBLE
PRECISION
|
FLOAT
(24)
|
ENUM
|
VARCHAR2
|
FLOAT
|
FLOAT
|
INT
|
NUMBER(10,
0)
|
INTEGER
|
NUMBER(10,
0)
|
LONGBLOB
|
BLOB,
RAW
|
LONGTEXT
|
CLOB,
RAW
|
MEDIUMBLOB
|
BLOB,
RAW
|
MEDIUMINT
|
NUMBER(7,
0)
|
MEDIUMTEXT
|
CLOB,
RAW
|
NUMERIC
|
NUMBER
|
REAL
|
FLOAT
(24)
|
SET
|
VARCHAR2
|
SMALLINT
|
NUMBER(5,
0)
|
TEXT
|
VARCHAR2,
CLOB
|
TIME
|
DATE
|
TIMESTAMP
|
DATE
|
TINYBLOB
|
RAW
|
TINYINT
|
NUMBER(3,
0)
|
TINYTEXT
|
VARCHAR2
|
VARCHAR
|
VARCHAR2,
CLOB
|
YEAR
|
NUMBER
|
Numeric Types
MySQL
|
Size
|
Oracle
|
BIGINT
|
8
Bytes
|
NUMBER
(19,0)
|
BIT
|
approximately
(M+7)/8 Bytes
|
RAW
|
DECIMAL(M,D)
|
M+2
bytes if D > 0, M+1 bytes if D = 0 (D+2, if M < D)
|
FLOAT(24),
BINARY_FLOAT
|
DOUBLE
|
8
Bytes
|
FLOAT(24),
BINARY_FLOAT, BINARY_DOUBLE
|
DOUBLE
PRECION
|
8
Bytes
|
FLOAT(24),
BINARY_DOUBLE
|
FLOAT(25<=X
<=53)
|
8
Bytes
|
FLOAT(24),
BINARY_FLOAT
|
FLOAT(X<=24)
|
4
Bytes
|
FLOAT,
BINARY_FLOAT
|
INT
|
4
Bytes
|
NUMBER
(10,0)
|
INTEGER
|
4
Bytes
|
NUMBER
(10,0)
|
MEDIUMINT
|
3
Bytes
|
NUMBER
(7,0)
|
NUMERIC
|
M+2
bytes if D > 0, M+1 bytes if D = 0 (D+2, if M < D)
|
NUMBER
|
REAL
|
8
Bytes
|
FLOAT(24),
BINARY_FLOAT
|
SMALLINT
|
2
Bytes
|
NUMBER(5,0)
|
TINYINT
|
1
Byte
|
NUMBER(3,0)
|
Date and Time Types
MySQL
|
Size
|
Oracle
|
DATE
|
3
Bytes
|
DATE
|
DATETIME
|
8
Bytes
|
DATE
|
TIMESTAMP
|
4
Bytes
|
DATE
|
TIME
|
3
Bytes
|
DATE
|
YEAR
|
1
Byte
|
NUMBER
|
String Types
MySQL
|
Size
|
Oracle
|
BLOB
|
L
+ 2 Bytes whereas L<2^16
|
RAW,
BLOB
|
CHAR(m)
|
M
Bytes, 0<=M<=255
|
CHAR
|
ENUM
(VALUE1, VALUE2, ...)
|
1
or 2 Bytes depending on the number of enum. values (65535 values max)
|
|
LONGBLOB
|
L
+ 4 Bytes whereas L < 2 ^ 32
|
RAW,
BLOB
|
LONGTEXT
|
L
+ 4 Bytes whereas L < 2 ^ 32
|
RAW,
CLOB
|
MEDIUMBLOB
|
L
+ 3 Bytes whereas L < 2^ 24
|
RAW,
BLOB
|
MEDIUMTEXT
|
L
+ 3 Bytes whereas L < 2^ 24
|
RAW,
CLOB
|
SET
(VALUE1, VALUE2, ...)
|
1,
2, 3, 4 or 8 Bytes depending on the number of set members (64 members
maximum)
|
|
TEXT
|
L
+ 2 Bytes whereas L<2^16
|
VARCHAR2,
CLOB
|
TINYBLOB
|
L
+ 1 Bytes whereas L<2 ^8
|
RAW,
BLOB
|
TINYTEXT
|
L
+ 1 Bytes whereas L<2 ^8
|
VARCHAR2
|
VARCHAR(m)
|
L+1
Bytes whereas L<=M and0<=M<=255 before MySQL 5.0.3 (0 <= M <=
65535 in MySQL 5.0.3 and later; effective maximum length is 65,532 bytes)
|
VARCHAR2,
CLOB
|
1 comment:
Valuable information....
Thanks
Sathish
Post a Comment