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

错误原因:

     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;

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值