Problem Note 48130: Incorrect results might be generated when you summarize a column in a database management system table
Running an SQL procedure (PROC) query against an Oracle database management system (DBMS) table might result in incorrect results if the query includes an inline view and a summary function both inside and outside of the inline view. The query that is passed to Oracle might not include the GROUP BY clause that was outside the inline view. Also, the summary function that was in the inline view might be recalculated outside the inline view, replacing the calculation from within the inline view.
The problem occurs if you submit a query similar to the following:
proc sql;
select cnts, count(*)
from ( select age, sex, count(*) as cnts
from oralib.class
group by age, sex)
group by cnts;
quit;
What gets submitted to Oracle might be similar to the following:
select COUNT(*) as cnts, COUNT(*) from ( select class."AGE", class."SEX",
COUNT(*) as cnts from CLASS group by CLASS."AGE", CLASS."SEX" )
The only workaround is to break up the query into two queries, such that the first query is the code within the inline view and the second includes the rest of the query, using the output from the first query as input.
Operating System and Release Information
SAS System | SAS/ACCESS Interface to Oracle | z/OS | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft® Windows® for x64 | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | 9.2 TS2M3 |
Microsoft Windows XP Professional | 9.2 TS1M0 | 9.2 TS2M3 |
Windows Vista | 9.2 TS1M0 | 9.2 TS2M3 |
Windows Vista for x64 | 9.2 TS1M0 | 9.2 TS2M3 |
64-bit Enabled AIX | 9.2 TS1M0 | 9.2 TS2M3 |
64-bit Enabled HP-UX | 9.2 TS1M0 | 9.2 TS2M3 |
64-bit Enabled Solaris | 9.2 TS1M0 | 9.2 TS2M3 |
HP-UX IPF | 9.2 TS1M0 | 9.2 TS2M3 |
Linux | 9.2 TS1M0 | 9.2 TS2M3 |
Linux for x64 | 9.2 TS1M0 | 9.2 TS2M3 |
OpenVMS on HP Integrity | 9.2 TS1M0 | 9.2 TS2M3 |
Solaris for x64 | 9.2 TS1M0 | 9.2 TS2M3 |
*
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.
Type: | Problem Note |
Priority: | alert |
Date Modified: | 2012-10-26 15:00:36 |
Date Created: | 2012-10-11 17:07:24 |