执行异常ORA-00918: column ambiguously defined
oracle查询报错信息:执行异常ORA-00918: column ambiguously defined
该错误信息意为有一列定义模糊,不知道是哪张表的。
通常在字段名前面加上前缀就可以解决。比如column改成a.column
在使用其他方案提供的查询工具时,外围可能包裹了类似select x.* from ('这里面是你要查询的sql') x where 1=2这样的语句,这时需要注意你的sql语句查询的列或定义的别名不要有重复,否则依然会报上述错误。
举例:
输入的sql为:
select a.amount as amount,a.qty*price as amount from product a
通过该工具最后生成的sql就变成了如下:
select x.* from (select a.amount as amount,a.qty*price as amount from product a) x where 1=2
这时,sql语句又产生了重复列明,导致报上述错误。