java.sql.SQLException: ORA-01799: a column may not be outer-joined to a subquery

来源:互联网 发布:june软件 编辑:程序博客网 时间:2024/05/17 22:05

错误原因:

     Oracle禁止在outer join后使用子查询,参考http://forums.oracle.com/forums/thread.jspa?threadID=945104&tstart=0

Presumably, Oracle has decided that the 9i behavior was incorrect-- you are doing an outer join to a subquery, which isn't allowed. The 9.2.0.1 parser didn't notice the error. Presumably, you're getting lucky and Oracle generates the correct output. But presumably the optimizer doesn't know how to handle this properly in all cases, so Oracle disallows it. The 10.2.0.4 behavior appears to be correct from Oracle's standpoint-- you'll need to refactor the code to avoid doing an outer join to a subquery.

 

翻译:据推测,Oracle 9i明白这种行为是错误的(你在outer join后使用子查询),但是9.2.0.1解析器没有提示这种错误,据推测,你非常幸运的生成了正确的输出.但是并不适用于所有情况.所以Oracle禁止这种操作.在10.2.0.4版本Oracle正确的拒绝这种操作,你应该重构你的代码来避免使用outer join后加入子查询.

 

参考2 http://www.oracle.com.cn/viewthread.php?tid=34336

ERROR at line 4:

ORA-01799: a column may not be outer-joined to a subquery
As a work around, you can use an inline view to achieve the desired effect:

SELECT E.LNAME

FROM EMPLOYEE E,

(SELECT DEPT_ID FROM DEPARTMENT WHERE NAME = 'ACCOUNTING') V

WHERE E.DEPT_ID (+) = V.DEPT_ID;

 

 

 

原创粉丝点击