首页 > 数据库技术 > 详细

java.sql.SQLException: ORA-00918: column ambiguously defined

时间:2014-04-11 15:04:20      阅读:498      评论:0      收藏:0      [点我收藏+]

oracle:

select * from t_apply a, (select distinct ta.misdn from t_userarea ta where ta.mobileshop_id in (
    select t.mobileshop_id from t_userarea t where t.misdn=#{omisdn})) b where a.misdn=b.misdn
and a.status=3
and a.id not in (
    select td.applyId from t_delapply td where td.misdn=#{omisdn}
)


在plsql中可以运行, 查询出数据.

但是在eclipse项目中运行报错:java.sql.SQLException: ORA-00918: column ambiguously defined.

多表操作时,语句中的列名,不明确.

修改成:

select a.* from t_apply a, (select distinct ta.misdn from t_userarea ta where ta.mobileshop_id in (
    select t.mobileshop_id from t_userarea t where t.misdn=#{omisdn})) b where a.misdn=b.misdn
and a.status=3
and a.id not in (
    select td.applyId from t_delapply td where td.misdn=#{omisdn}
)

就可以了.





本文出自 “点点滴滴” 博客,请务必保留此出处http://alittlebit.blog.51cto.com/1994086/1393461

java.sql.SQLException: ORA-00918: column ambiguously defined,布布扣,bubuko.com

java.sql.SQLException: ORA-00918: column ambiguously defined

原文:http://alittlebit.blog.51cto.com/1994086/1393461

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!