SQL types mapping: Oracle MySQL
Original data types | Oracle MySQL data types |
---|---|
CHAR(n) |
CHAR(n) or TEXT (see note 1) |
VARCHAR(n[,m]) |
VARCHAR(n) (see note 1) |
LVARCHAR(n) |
VARCHAR(n) (see note 1) |
NCHAR(n) |
NCHAR(n) (see note 1) |
NVARCHAR(n[,m]) |
NVARCHAR(n) (see note 1) |
BOOLEAN |
BOOLEAN |
SMALLINT |
SMALLINT |
INTEGER |
INTEGER |
BIGINT |
BIGINT |
INT8 |
BIGINT |
SERIAL[(start)] |
INTEGER (see note 2) |
BIGSERIAL[(start)] |
BIGINT (see note 2) |
SERIAL8[(start)] |
BIGINT (see note 2) |
DOUBLE PRECISION / FLOAT[(n)] |
DOUBLE |
REAL / SMALLFLOAT |
FLOAT |
DECIMAL(p,s) |
DECIMAL(p,s) |
DECIMAL(p) with p<=15 |
DECIMAL(p*2,p) |
DECIMAL(p) with >15 |
N/A |
DECIMAL |
DECIMAL(32,16) (see note 3) |
MONEY(p,s) |
DECIMAL(p,s) |
MONEY(p) |
DECIMAL(p,2) |
MONEY |
DECIMAL(16,2) |
DATE |
DATE |
DATETIME HOUR TO MINUTE |
TIME |
DATETIME HOUR TO SECOND |
TIME |
DATETIME HOUR TO FRACTION(p) |
TIME(p) |
DATETIME YEAR TO MONTH |
DATETIME |
DATETIME YEAR TO DAY |
DATETIME |
DATETIME YEAR TO HOUR |
DATETIME |
DATETIME YEAR TO MINUTE |
DATETIME |
DATETIME YEAR TO SECOND |
DATETIME |
DATETIME YEAR TO FRACTION(p) |
DATETIME(p) |
INTERVAL q1 TO q2 |
CHAR(50) |
TEXT |
MEDIUMTEXT / LONGTEXT (max is 2Gb) |
BYTE |
MEDIUMBLOB / LONGBLOB (max is 2Gb) |
Notes:
- The
CHAR
types with a size > 255 are convertedTEXT
types. For more details, see CHAR and VARCHAR data types. - For serial emulation, see SERIAL and BIGSERIAL data type.
- The
DECIMAL(32,16)
type is not supported by MySQL and MariaDB and will produce an SQL error.