SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 62488: Writing numeric values to Oracle might cause precision loss

DetailsHotfixAboutRate It

When you write numeric values to Oracle, you might encounter precision loss.

For example, you might encounter this problem when you perform steps similar to the following:

  1. Create a table in Oracle named MYDEC.
  2. Add values (including 104.88) to the table.
  3. Connect to SAS® Federation Server.
  4. Run code similar to the following to read a value with type NUMERIC(15,2) from an Oracle database:​​​​
    libname fedora fedsvr server="server-name" port=24141 user="user-ID"
    password="server-password"  dsn="oracle-dsn" catalog="​​​​​​​c​​​​​atalog-name"​​​​​​​ schema="​​​​​​​schema-name"​​​​​​​ ;
    proc sql ;
    drop table fedora.feddec;
    create table fedora.feddec as select * from fedora.mydec;
    select * from fedora.feddec;
    * got value 104.87 ;
    quit ;
  5. Write the value to an Oracle database. The value is stored as 104.87 in the Oracle database.

This loss of precision is typical of floating-point arithmetic. Base SAS® uses an IEEE double format (8 bytes) to save numeric values. This format does not specify exact values, and it supports precision up to 15 digits. 

For example, with this format, 104.88 in Oracle might be read into SAS as 104.879999999999995. When writing the SAS value back to Oracle with format NUMERIC(16,2), SAS incorrectly truncates the value to 104.87.

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS Federation ServerMicrosoft® Windows® for x644.29.4 TS1M3
Microsoft Windows 8 Enterprise 32-bit4.29.4 TS1M3
Microsoft Windows 8 Enterprise x644.29.4 TS1M3
Microsoft Windows 8 Pro 32-bit4.29.4 TS1M3
Microsoft Windows 8 Pro x644.29.4 TS1M3
Microsoft Windows 8.1 Enterprise 32-bit4.29.4 TS1M3
Microsoft Windows 8.1 Enterprise x644.29.4 TS1M3
Microsoft Windows 8.1 Pro 32-bit4.29.4 TS1M3
Microsoft Windows 8.1 Pro x644.29.4 TS1M3
Microsoft Windows 104.29.4 TS1M3
Microsoft Windows Server 20084.29.4 TS1M3
Microsoft Windows Server 2008 R24.29.4 TS1M3
Microsoft Windows Server 2008 for x644.29.4 TS1M3
Microsoft Windows Server 2012 Datacenter4.29.4 TS1M3
Microsoft Windows Server 2012 R2 Datacenter4.29.4 TS1M3
Microsoft Windows Server 2012 R2 Std4.29.4 TS1M3
Microsoft Windows Server 2012 Std4.29.4 TS1M3
Windows 7 Enterprise 32 bit4.29.4 TS1M3
Windows 7 Enterprise x644.29.4 TS1M3
Windows 7 Home Premium 32 bit4.29.4 TS1M3
Windows 7 Home Premium x644.29.4 TS1M3
Windows 7 Professional 32 bit4.29.4 TS1M3
Windows 7 Professional x644.29.4 TS1M3
Windows 7 Ultimate 32 bit4.29.4 TS1M3
Windows 7 Ultimate x644.29.4 TS1M3
64-bit Enabled AIX4.29.4 TS1M3
64-bit Enabled Solaris4.29.4 TS1M3
HP-UX IPF4.29.4 TS1M3
Linux for x644.29.4 TS1M3
Solaris for x644.29.4 TS1M3
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.