SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 63630: Performance issues or an ORA-01841 error might occur when you query a database management system (DBMS) table

DetailsHotfixAboutRate It

You might encounter the issues that are detailed in this note in the following scenarios:

  • You install Hot Fix I22107, Hot Fix I22132, and Hot Fix I22134 [SAS® 9.3M2 (TS1M2)].
  • You install Hot Fix V01070 and Hot Fix V01089 [SAS® 9.4M3 (TS1M3)].
  • You install Hot Fix A3Z047 [SAS® 9.4M4 (TS1M4)].
  • You are running SAS® 9.4M5 (TS1M5)
  • You are running SAS® 9.4M6 (TS1M6)  prior to Rev. 940_19w47
  • You are running Viya 3.2, 3.3 or 3.4

Issue #1

A performance issue might occur if the following is true about your SQL procedure query: 

  • You are accessing DBMS tables via a LIBNAME engine.
  • You include one of the following as part of a WHERE clause:
    • the between operator is used to compare a variable to two constant values
    • the <= and >= operators are used to compare a variable to two constant values
    • the < and > operators are used to compare a variable to two constant values
  • The SQL query does not contain any of the following:
    • DISTINCT
    • ORDER BY
    • JOIN of 2 or more tables using the same libref
    • GROUP BY
    • set operator other than OUTER UNION
    • aggregate function
    • HAVING clause
    • WHERE clause containing a subquery that references a DBMS table using the same libref

Issue #2

An Oracle error might occur if the following is true about your PROC SQL query:

  • You are accessing Oracle tables via a LIBNAME engine.
  • You include one of the following as part of a WHERE clause:
    • the between operator is used to compare a date variable to two constant values
    • the <= and >= operators are used to compare a date variable to two constant values
    • the < and > operators are used to compare a date variable to two constant values
  • The table is partitioned by month on the date variable that is being referenced in the WHERE clause.
  • The SQL query does not contain any of the following:
    • DISTINCT
    • ORDER BY
    • JOIN of 2 or more tables using the same libref
    • GROUP BY
    • set operator other than OUTER UNION
    • aggregate function
    • HAVING clause
    • WHERE clause containing a subquery that references a DBMS table using the same libref

The Oracle error might look similar to the following:

ERROR: ORACLE prepare error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0.

These issues occur due to an OR condition that is being added to the query submitted to the database in order to support linguistic-sensitive environments. For more information, see SAS Note 54751, "The BETWEEN operator might re-order values, possibly leading to unexpected results in a linguistic-sensitive environment." 

A possible workaround is to specify the variable comparison using the DBCONDITION= data set option.

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

The hot fix addresses queries for non-character variables for issue #1 and date variables for issue #2. 

 



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemBase SASSolaris for x649.3_M29.3 TS1M2
Linux for x649.3_M29.3 TS1M2
Linux9.3_M29.3 TS1M2
HP-UX IPF9.3_M29.3 TS1M2
64-bit Enabled Solaris9.3_M29.3 TS1M2
64-bit Enabled HP-UX9.3_M29.3 TS1M2
64-bit Enabled AIX9.3_M29.3 TS1M2
Windows Vista for x649.3_M29.3 TS1M2
Windows Vista9.3_M29.3 TS1M2
Windows 7 Ultimate x649.3_M29.3 TS1M2
Windows 7 Ultimate 32 bit9.3_M29.3 TS1M2
Windows 7 Professional x649.3_M29.3 TS1M2
Windows 7 Professional 32 bit9.3_M29.3 TS1M2
Windows 7 Home Premium x649.3_M29.3 TS1M2
Windows 7 Home Premium 32 bit9.3_M29.3 TS1M2
Windows 7 Enterprise x649.3_M29.3 TS1M2
Windows 7 Enterprise 32 bit9.3_M29.3 TS1M2
Microsoft Windows XP Professional9.3_M29.3 TS1M2
Microsoft Windows Server 2012 Std9.3_M29.3 TS1M2
Microsoft Windows Server 2012 R2 Std9.3_M29.3 TS1M2
Microsoft Windows Server 2012 R2 Datacenter9.3_M29.3 TS1M2
Microsoft Windows Server 2012 Datacenter9.3_M29.3 TS1M2
Microsoft Windows Server 2008 for x649.3_M29.3 TS1M2
Microsoft Windows Server 2008 R29.3_M29.3 TS1M2
Microsoft Windows Server 20089.3_M29.3 TS1M2
Microsoft Windows Server 2003 for x649.3_M29.3 TS1M2
Microsoft Windows 8 Enterprise x649.3_M29.3 TS1M2
Microsoft Windows 8 Pro 32-bit9.3_M29.3 TS1M2
Microsoft Windows 8 Pro x649.3_M29.3 TS1M2
Microsoft Windows 8.1 Enterprise 32-bit9.3_M29.3 TS1M2
Microsoft Windows 8.1 Enterprise x649.3_M29.3 TS1M2
Microsoft Windows 8.1 Pro 32-bit9.3_M29.3 TS1M2
Microsoft Windows 8.1 Pro x649.3_M29.3 TS1M2
Microsoft Windows Server 2003 Datacenter Edition9.3_M29.3 TS1M2
Microsoft Windows Server 2003 Enterprise Edition9.3_M29.3 TS1M2
Microsoft Windows Server 2003 Standard Edition9.3_M29.3 TS1M2
z/OS9.3_M29.3 TS1M2
z/OS 64-bit9.3_M29.3 TS1M2
Microsoft® Windows® for x649.3_M29.3 TS1M2
Microsoft Windows 8 Enterprise 32-bit9.3_M29.3 TS1M2
SAS SystemSAS ViyaMicrosoft® Windows® for x643.43.5ViyaViya
Linux for x643.23.5Viya
* 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.