FIX: The value of NUMBER type is truncated when you select data from an Oracle-linked server by using OLE DB provider

Symptoms

When you execute a query to select data from an Oracle-linked server by using OLE DB provider in Microsoft SQL Server 2012 or SQL Server 2014, the values in the NUMBER type column may be truncated in the query result.

Cause

This issue occurs because, the Oracle NUMBER type with non-declared precision/scale may not have a clear 1:1 mapping to a SQL Server data type. Before SQL Server 2012 SP2 CU2, SQL Server maps such values to strings to make sure that no loss of precision happens. However, that could lead to incorrect results if the query required sort order on such values. In SQL Server 2012 SP2 CU2, the mapping is changed to numeric (38, 0) to allow for representation of big integer keys which some database schemas are using NUMBER without precision/scale for. This leads to regressions when non-integer values are needed.

Resolution

After you apply this fix, NUMBER values with unknown precision/scale are treated as double values with OLE DB provider. If the precision is important and the range of the values is not large enough, you can enable the new Trace Flag 7314 that would start treating such values as numeric (38, 10).

The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 1 for SQL Server 2014 SP1

Cumulative Update 8 for SQL Server 2014

Cumulative Update 6 for SQL Server 2012 SP2

About cumulative updates for SQL Server

Workaround

To work around this issue, convert the Oracle field from NUMBER type to a data type that is fully supported by SQL Server first.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.



Third-party information disclaimer
Properties

Article ID: 3051993 - Last Review: Oct 31, 2016 - Revision: 1

Microsoft SQL Server 2012 Service Pack 2, Microsoft SQL Server 2012 Developer, Microsoft SQL Server 2012 Enterprise, Microsoft SQL Server 2012 Standard, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Service Pack 1, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2014 Standard

Feedback