Skip to content

Oracle data type reference

Oracle to PostgreSQL, MySQL, SQL Server and Db2: data type mapping

Every Oracle column type we map, what it becomes in each target database, and the Oracle habits that catch people out.

Updated · from our Database Migration Platform’s type rules

Where these mappings come from

The defaults our platform proposes

Each target type below is the default our Database Migration Platform proposes for a Oracle column, and every project can override any of them. The notes are what we check when planning a migration: where a value can round, lose information or behave differently on the new engine. “Same type” means the type name is kept; check binary lengths and time precision on the target.

Oracle to each target: testing status
Oracle → PostgreSQLAutomated end-to-end test; live change capture tested on Oracle 23ai (Nov 2026)
Oracle → MySQLSupported, not yet tested
Oracle → SQL ServerSupported, not yet tested
Oracle → OracleSupported, not yet tested
Oracle → Db2Supported, not yet tested

Numbers

  • number(p,s)

    PostgreSQL
    NUMERIC(p, s)
    MySQL
    DECIMAL(p, s)
    SQL Server
    DECIMAL(p, s)
    Oracle
    Same type
    Db2
    DECIMAL(p, s)

    Precision and scale are kept. An identity column becomes BIGINT on PostgreSQL, and foreign keys that point at it follow, so the key types match.

  • number

    PostgreSQL
    NUMERIC
    MySQL
    DECIMAL
    SQL Server
    DECIMAL
    Oracle
    Same type
    Db2
    DECIMAL

    Without a precision it stays an unbounded number on PostgreSQL. Elsewhere a DECIMAL without precision has a small default (MySQL 10,0; SQL Server 18,0; Db2 5,0), so set an explicit precision there or values round.

  • integer

    PostgreSQL
    NUMERIC(38, 0)
    MySQL
    DECIMAL(38, 0)
    SQL Server
    DECIMAL(38, 0)
    Oracle
    Same type
    Db2
    DECIMAL(38, 0)

    In Oracle this is NUMBER(38), so it lands as a 38-digit number, not a 4-byte integer. Db2 DECIMAL holds at most 31 digits, so narrow it there, and anywhere the values allow.

  • float(p)

    PostgreSQL
    NUMERIC
    MySQL
    DECIMAL
    SQL Server
    DECIMAL
    Oracle
    Same type
    Db2
    DECIMAL

    A decimal float of up to 126 binary digits (about 38 decimal digits). On PostgreSQL it lands as unbounded NUMERIC, because a double would round it to about 15 digits. MySQL, SQL Server and Db2 get a DECIMAL without precision, whose small defaults lose every fraction: set a precision there.

  • binary_float

    PostgreSQL
    REAL
    MySQL
    FLOAT
    SQL Server
    REAL
    Oracle
    Same type
    Db2
    REAL

    4-byte IEEE floating point everywhere.

  • binary_double

    PostgreSQL
    DOUBLE PRECISION
    MySQL
    DOUBLE
    SQL Server
    FLOAT
    Oracle
    Same type
    Db2
    DOUBLE

    8-byte IEEE floating point everywhere.

Text

  • char(n), nchar(n)

    PostgreSQL
    CHAR(n)
    MySQL
    CHAR(n)
    SQL Server
    NCHAR(n)
    Oracle
    Same type
    Db2
    CHAR(n)

    Padded with spaces.

  • varchar2(n), nvarchar2(n)

    PostgreSQL
    VARCHAR(n)
    MySQL
    VARCHAR(n)
    SQL Server
    NVARCHAR(n)
    Oracle
    Same type
    Db2
    VARCHAR(n)

    VARCHAR2(n) counts bytes unless declared n CHAR; PostgreSQL and MySQL count characters, so the same n fits. Oracle stores '' as NULL, so the source has no empty strings to carry over.

  • clob, nclob, long

    PostgreSQL
    TEXT
    MySQL
    LONGTEXT
    SQL Server
    NVARCHAR(MAX)
    Oracle
    Same type
    Db2
    CLOB

    LONG is deprecated in Oracle and has many restrictions; CLOB values can be very large, so check the target’s single-value limit (1 GB in PostgreSQL).

  • xmltype

    PostgreSQL
    TEXT
    MySQL
    LONGTEXT
    SQL Server
    NVARCHAR(MAX)
    Oracle
    Same type
    Db2
    CLOB

    Lands as text. PostgreSQL has an xml type if you query the content with XPath.

Dates and times

  • date

    PostgreSQL
    TIMESTAMP(6)
    MySQL
    DATETIME(6)
    SQL Server
    DATETIME2
    Oracle
    Same type
    Db2
    TIMESTAMP

    Oracle DATE carries a time of day to the second, so it lands as a timestamp, not a date. Code that relied on TRUNC(date) needs a date_trunc or a cast.

  • timestamp(n)

    PostgreSQL
    TIMESTAMP(6)
    MySQL
    DATETIME(6)
    SQL Server
    DATETIME2
    Oracle
    Same type
    Db2
    TIMESTAMP

    Up to 9 fractional digits; SQL Server keeps 7 and the other targets 6, so the rest is rounded.

  • timestamp with time zone, with local time zone

    PostgreSQL
    TIMESTAMPTZ(6)
    MySQL
    DATETIME(6)
    SQL Server
    DATETIMEOFFSET
    Oracle
    Same type
    Db2
    TIMESTAMP

    PostgreSQL stores the instant in UTC and drops the original zone or region name; MySQL and Db2 keep no zone at all.

  • interval year to month, interval day to second

    PostgreSQL
    TEXT
    MySQL
    LONGTEXT
    SQL Server
    NVARCHAR(MAX)
    Oracle
    Same type
    Db2
    CLOB

    Lands as text. Convert it to PostgreSQL INTERVAL afterwards if the application calculates with it.

Binary and special types

  • raw(n), long raw, blob

    PostgreSQL
    BYTEA
    MySQL
    LONGBLOB
    SQL Server
    VARBINARY(MAX)
    Oracle
    Same type
    Db2
    BLOB

    BLOB values can exceed PostgreSQL BYTEA’s 1 GB per value.

  • bfile

    PostgreSQL
    BYTEA
    MySQL
    LONGBLOB
    SQL Server
    VARBINARY(MAX)
    Oracle
    Same type
    Db2
    BLOB

    A pointer to a file outside the database. Change capture does not carry BFILE contents; copy the files separately.

  • rowid, urowid

    PostgreSQL
    VARCHAR(n)
    MySQL
    VARCHAR(n)
    SQL Server
    NVARCHAR(n)
    Oracle
    Same type
    Db2
    VARCHAR(n)

    A physical row address in the source database; it means nothing on the target, so drop it unless something stored it as a key. The driver can report a length shorter than its 18-character text form: widen the column if you keep it.

  • sdo_geometry, boolean (23ai), user-defined types

    PostgreSQL
    TEXT
    MySQL
    TEXT
    SQL Server
    NVARCHAR(MAX)
    Oracle
    Same type
    Db2
    CLOB

    Not in the default rules, so these land as text and are flagged for review. Spatial data needs PostGIS on PostgreSQL.

Planning a Oracle migration? We can map your schema and run the move with change data capture.

Database migration services

Beyond types

What a type table does not show

The schema can convert cleanly and the application still break. These are the usual reasons with Oracle.

01

Empty strings are NULL

Oracle stores '' as NULL, so Oracle code often tests IS NULL where other databases would test for an empty string. After the move, '' and NULL are different values: check queries and NOT NULL constraints.

02

NUMBER keys

Oracle keys are often plain NUMBER. On PostgreSQL our platform makes identity columns BIGINT and aligns the foreign keys that reference them, because an identity column must be an integer type there.

03

DATE has a time

An Oracle DATE holds a time of day, so it lands as a timestamp. Reports that grouped by TRUNC(date) need date_trunc() or a cast to date on PostgreSQL.

04

Packages, synonyms and DUAL

PL/SQL packages, synonyms and the DUAL table have no direct equivalent in PostgreSQL. They are rewritten, not converted, so list them early.

Notes per target

Landing in each database

Into PostgreSQL

  • Unquoted names fold to lower case, and names are cut at 63 bytes. Pick lower-case names that fit before creating the schema.
  • Identity columns land as GENERATED BY DEFAULT AS IDENTITY. Our platform moves each sequence past the current maximum after the load and again at cutover; if you load by hand, use setval, or the first insert collides.
  • Text cannot hold the NUL character (0x00). Find and clean such values before the load.
  • Comparisons are case-sensitive by default. Use citext or a nondeterministic ICU collation where the source compared case-insensitively.

Into MySQL

  • Create the database with utf8mb4. The older utf8 (utf8mb3) cannot store emoji and some other characters.
  • All columns except TEXT and BLOB share a 65,535-byte row limit, and utf8mb4 counts up to 4 bytes a character. CHAR(n) allows at most 255.
  • Text with no declared length lands as TEXT, which holds 64 KB: override to MEDIUMTEXT or LONGTEXT for larger values. TEXT and BLOB columns need a prefix length to be indexed.
  • TIME has no fractional seconds unless declared TIME(6), so fractions are lost. DATETIME(6) holds microseconds but no time zone.
  • A boolean arrives as TINYINT(1): 0 or 1, though the column also accepts other small integers.

Into SQL Server

  • Text lands as NVARCHAR/NCHAR, so Unicode is safe. NVARCHAR(n) allows n up to 4,000: longer declared lengths need NVARCHAR(MAX), which cannot be an index key.
  • Most SQL Server databases compare case-insensitively, unlike PostgreSQL, Oracle and Db2.
  • Identity columns are not re-seeded automatically: run DBCC CHECKIDENT after the load.
  • DATETIME2 keeps up to 100 ns. DATETIMEOFFSET keeps an offset, but values from a UTC source (such as PostgreSQL timestamptz) arrive as +00:00.
  • JSON lands as NVARCHAR(MAX). SQL Server 2025 has a native json type if you want one.
  • There is no boolean type: BIT holds 0, 1 or NULL.

Into Db2

  • Booleans land as SMALLINT (0 or 1) and UUIDs as VARCHAR(36) text.
  • Timestamps land as plain TIMESTAMP, which keeps 6 fractional digits and no time zone: values with a zone are stored without it, so convert them to UTC first. TIME has no fractional seconds.
  • Identity columns are not re-seeded automatically: use ALTER TABLE … ALTER COLUMN … RESTART WITH after the load.
  • A VARCHAR holds up to 32,672 bytes, CHAR up to 255 and DECIMAL up to 31 digits; wider columns need an override. Text with no length and JSON land as CLOB.
  • The JDBC driver (jcc) ships separately under IBM’s licence.

FAQ

Common questions

What does Oracle NUMBER map to in PostgreSQL?
NUMERIC with the same precision and scale, or unbounded NUMERIC for a plain NUMBER. Identity columns become BIGINT so they can stay identity columns.
What does Oracle DATE map to in PostgreSQL?
TIMESTAMP, because an Oracle DATE carries a time of day to the second. Use date_trunc() or a cast where the code only wanted the date.
What does Oracle NUMBER map to in SQL Server?
DECIMAL with the same precision and scale. A plain NUMBER has none, and SQL Server’s default DECIMAL is (18,0), so set a precision and scale before loading or fractions are lost.
What happens to Oracle empty strings in PostgreSQL?
There are none to move: Oracle stores '' as NULL. After the move PostgreSQL treats '' and NULL as different values, so queries that relied on Oracle’s behaviour need checking.