Docs Menu
Docs Home
/ /

Data Type Conversion Reference

This page outlines examples that show the result of converting the source value and data type to a specific BSON data type using customized fields.

  • Migration job errors result in BsonNull values for the impacted fields. Your field's null handling strategy does not affect this behavior.

  • Your migration job continues with errors unless it reaches the threshold that you defined when you created the migration job.

  • When defining Calculated Fields and Customize ID Fields, Relational Migrator shows an initial data type of default. When you run a migration job, Relational Migrator updates this data type.

The following example shows results from applying data type customization for the value 100 with an Integer data type.

Conversion Type
Conversion Value

Boolean

false

Date

Thu Jan 01 10:00:00 AEST 1970

Decimal

100.0

Double

100.0

Integer

100

Long

100

String

100

The following example shows results from applying data type customization for the value true with a Boolean data type.

Conversion Type
Conversion Value

Boolean

true

Date

Thu Jan 01 10:00:00 AEST 1970

Decimal

1.0

Double

1.0

Integer

1

Long

1

String

"true"

The following example shows results from applying data type customization for the value 1233140483647 with a Long data type.

Conversion Type
Conversion Value

Boolean

false

Date

Wed Jan 28 22:01:23 AEDT 2009

Decimal

1233140483647.0

Double

1233140483647.0

Integer

Error (Too big)

Long

1233140483647

String

"1233140483647"

The following example shows results from applying data type customization for the value 26.55 with a Decimal data type.

Conversion Type
Conversion Value

Boolean

false

Date

Error

Decimal

26.55

Double

26.55

Integer

26

Long

26

String

"26.55"

The following example shows results from applying data type customization for the value "Hello" with a String data type.

Conversion Type
Conversion Value

Boolean

false

Date

Error

Decimal

Error

Double

Error

Integer

Error

Long

Error

String

"Hello"

The following example shows results from applying data type customization for the value "true" with a String data type.

Conversion Type
Conversion Value

Boolean

true

Date

Error

Decimal

Error

Double

Error

Integer

Error

Long

Error

String

"true"

Oracle TIMESTAMP(0-9) columns support the following BSON type options. The example uses the source value 2025-01-01 12:34:56.123456789 with a TIMESTAMP(9) data type.

BSON Type
Behavior
Example Output

Date (default)

Truncates to millisecond precision. For TIMESTAMP(0-3), no precision loss occurs.

2025-01-01T12:34:56.123Z

String

Preserves full sub-millisecond precision as a string.

"2025-01-01 12:34:56.123456789Z"

Long (milliseconds)

Stores milliseconds since Unix epoch as Int64.

1735734896123

Long (microseconds)

Stores microseconds since Unix epoch as Int64.

1735734896123456

Long (nanoseconds)

Stores nanoseconds since Unix epoch as Int64.

1735734896123456789

Oracle TIMESTAMP WITH TIME ZONE columns support the following BSON type options. The example uses the source value 2025-01-01 12:34:00.000 -05:00.

Note

In releases prior to 1.15.4, selecting Date for TIMESTAMP WITH TIME ZONE columns stored the local time without shifting to UTC. The updated Date (UTC) option shifts the timestamp to UTC using the original time zone offset.

BSON Type
Behavior
Example Output

String (default)

Stores the full timestamp including the time zone offset as a string.

"2025-01-01 12:34:00.000 -05:00"

Date (UTC)

Shifts the timestamp to UTC using the original time zone offset.

2025-01-01T17:34:00.000Z

Date (Strip Time Zone)

Stores local wall-clock time as-is in UTC, ignoring the time zone offset.

2025-01-01T12:34:00.000Z

Date and String (Separate fields)

Creates two sub-fields: timestamp (BSON Date) and timeZone (BSON String).

{ timestamp: 2025-01-01T12:34:00Z, timeZone: "-05:00" }

Long (milliseconds)

Stores milliseconds since UTC-equivalent time as Int64.

1735752840000

Long (microseconds)

Stores microseconds since UTC-equivalent time as Int64.

1735752840000000

Long (nanoseconds)

Stores nanoseconds since UTC-equivalent time as Int64.

1735752840000000000

Oracle NUMBER columns support the following BSON type options. The default BSON type depends on the column's scale (s) and integer precision (p - s):

  • s > 0: Decimal (Decimal128)

  • s <= 0 and (p - s) < 10: Integer (BsonInt32)

  • s <= 0 and 10 <= (p - s) < 19: Long (BsonInt64)

  • s <= 0 and (p - s) >= 19: Decimal (Decimal128)

The example uses the source value 123456789.

BSON Type
Behavior
Example Output

Bool

Treats 0 as false and any non-zero numeric value as true.

true

Date

Interprets the NUMBER as milliseconds since the Unix epoch (1970-01-01T00:00:00Z). Large values can overflow and produce an invalid date.

1970-01-02T10:17:36.789+00:00

Decimal

Maps to BSON Decimal128. Values with more than 34 significant digits may lose precision.

123456789

Double

Converts to BSON Double (64-bit floating point). Large or high-precision values may lose precision due to IEEE 754 rounding.

123456789

Integer

Maps to BSON Int32. Values that exceed the Int32 range result in an error.

123456789

Long

Maps to BSON Int64. Values that exceed the Int64 range result in an error.

123456789

String

Preserves all digits as a string. Use when full numeric fidelity is required.

"123456789"

When the source value exceeds 34 significant digits, the Decimal mapping may lose precision. The following example uses the source value 12345678901234567890123456789012345678 (38 significant digits).

BSON Type
Behavior
Example Output

Decimal

Values with more than 34 significant digits may lose precision.

1.234567890123456789012345678901234E+37

String

Preserves all digits as a string. Use when full numeric fidelity is required.

"12345678901234567890123456789012345678"

Relational Migrator maps Oracle XMLTYPE columns to BSON String, storing the XML document as a string value.

Note

To migrate XMLTYPE columns, ensure that the xdb.jar Oracle JDBC driver file is available.

Back

Custom Fields

On this page