ORA-01791: not a SELECTed expression after upgrade to 11.2.0.4 (文档 ID 1600974.1)



ORA-01791: not a SELECTed expression after upgrade to 11.2.0.4 (文档 ID 1600974.1) 转到底部

In this Document

Symptoms
  Changes
  Cause
  Solution
  References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

SYMPTOMS

a select DISTINCT query and the order by column does not reference a select list item after upgrade to 11.2.0.4

SQL> select distinct sal, empno from scott.emp order by deptno;
select distinct sal, empno from scott.emp order by deptno
                                                   *
ERROR at line 1:
ORA-01791: not a SELECTed expression

But it was working on previous release ..

SQL> select distinct sal, empno from scott.emp order by deptno;

       SAL      EMPNO
---------- ----------
      2450       7782
      5000       7839

 

CHANGES

 upgrade to 11.2.0.4

CAUSE

 The issue have been investigated in the following bug:

Bug:17655864 - ORA-01791: NOT A SELECTED EXPRESSION AFTER 11.2.0.4 PATCH

which is closed as not a bug. and this is expected behvior .

so the correct behavior is on 11.2.0.4 and not older versions.

This is due to 

BUG 13768663 - SELECT WORKS IN 10.2 AND 11.2.0.3 FAILS 11.1.0.7 ORA-01791

Invalid query which should raise ORA-1791 is working fine without any error starting from 11.2.0.1.This is fixed in 11.2.0.4 and hence you may get the error ORA-1791 in 11.2.0.4.

SOLUTION

The expected behaviour for this statement is that it should report ORA-01791 That is, this is a select DISTINCT query and the order by column does not reference a select list item. This is a documented restriction of the order by clause.

http://docs.oracle.com/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF20039
 

This behaviour is corrected through bugfix 13768663.

so please add the orderby column in the select statement

SQL> select distinct sal, empno, deptno from scott.emp order by deptno;

       SAL      EMPNO     DEPTNO
---------- ---------- ----------
      2450       7782         10
      5000       7839         10
      1300       7934         10

REFERENCES

BUG:17655864 - ORA-01791: NOT A SELECTED EXPRESSION AFTER 11.2.0.4 PATCH
NOTE:13768663.8 - Bug 13768663 - ORA-1791 not reported in 11.2 when expected
BUG:13768663 - SELECT WORKS IN 10.2 AND 11.2.0.3 FAILS 11.1.0.7 ORA-01791

In this Document

Symptoms
  Changes
  Cause
  Solution
  References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

SYMPTOMS

a select DISTINCT query and the order by column does not reference a select list item after upgrade to 11.2.0.4

SQL> select distinct sal, empno from scott.emp order by deptno;
select distinct sal, empno from scott.emp order by deptno
                                                   *
ERROR at line 1:
ORA-01791: not a SELECTed expression

But it was working on previous release ..

SQL> select distinct sal, empno from scott.emp order by deptno;

       SAL      EMPNO
---------- ----------
      2450       7782
      5000       7839

 

CHANGES

 upgrade to 11.2.0.4

CAUSE

 The issue have been investigated in the following bug:

Bug:17655864 - ORA-01791: NOT A SELECTED EXPRESSION AFTER 11.2.0.4 PATCH

which is closed as not a bug. and this is expected behvior .

so the correct behavior is on 11.2.0.4 and not older versions.

This is due to 

BUG 13768663 - SELECT WORKS IN 10.2 AND 11.2.0.3 FAILS 11.1.0.7 ORA-01791

Invalid query which should raise ORA-1791 is working fine without any error starting from 11.2.0.1.This is fixed in 11.2.0.4 and hence you may get the error ORA-1791 in 11.2.0.4.

SOLUTION

The expected behaviour for this statement is that it should report ORA-01791 That is, this is a select DISTINCT query and the order by column does not reference a select list item. This is a documented restriction of the order by clause.

http://docs.oracle.com/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF20039
 

This behaviour is corrected through bugfix 13768663.

so please add the orderby column in the select statement

SQL> select distinct sal, empno, deptno from scott.emp order by deptno;

       SAL      EMPNO     DEPTNO
---------- ---------- ----------
      2450       7782         10
      5000       7839         10
      1300       7934         10

REFERENCES

BUG:17655864 - ORA-01791: NOT A SELECTED EXPRESSION AFTER 11.2.0.4 PATCH
NOTE:13768663.8 - Bug 13768663 - ORA-1791 not reported in 11.2 when expected
BUG:13768663 - SELECT WORKS IN 10.2 AND 11.2.0.3 FAILS 11.1.0.7 ORA-01791

文档详细信息

 
 
  类型:
  状态:
  上次主更新:
  上次更新:
 
  PROBLEM
  PUBLISHED
  2014-7-31
  2014-7-31
     
 

相关产品

 
Oracle Database - Enterprise Edition
     
 

信息中心

 
   
Index of Oracle Database Information Centers [1568043.2]
Information Center: Overview of Database Security Products [1548952.2]
Information Center: Overview Database Server/Client Installation and Upgrade/Migration [1351022.2]
     
 

文档引用

 
   
Bug 13768663 - ORA-1791 not reported in 11.2 when expected [13768663.8]
     
 

最近查看

 
ORA-01791: not a SELECTed expression after upgrade to 11.2.0.4 [1600974.1]
Oracle Recommended Patches -- Oracle Database [756671.1]
Files being deleted in the flash recovery area, messages in the alert log Deleted Oracle managed file <filename> [1369341.1]
Query from subscriber errors with Ora-8103 [1365868.1]
Master Note for Handling Oracle Database Corruption Issues [1088018.1]
显示更多
     

你可能感兴趣的:(ORA-01791: not a SELECTed expression after upgrade to 11.2.0.4 (文档 ID 1600974.1))