ORA-00918: column ambiguously defined错误应对方法
来源:互联网 发布:mysql数据库筛选 编辑:程序博客网 时间:2024/06/06 02:34
最近做一个项目,经常需要用到多表查询,通过需要分页等,于是经常会碰到
ORA-00918: column ambiguously defined错误应对方法,意思是说,某一列定义模糊,于是
经过了很多方面的测试,总算能解决,尤其是在涉及到tablename.*,这里的*很容易出现这样的错误。
需要仔细的研究下面的2个sql语句:
select v1.*,(v1.data-v2.data) as rate, v3.*, (v3.data-v4.data) as rate2
from (
select rownum as rn, a.* from (
select ayearmon, DATA, DATA-100 as rate
from test
where isvalid=1 and code='3503'
and region = '000000'
order by ayearmon desc
) a) v1,
(
select (rownum-1) as rn1, b.* from (
select ayearmon, DATA
from test
where isvalid=1 and code='3503'
and region = '000000'
order by ayearmon desc
) b) v2,
( select rownum as rn, c.* from (
select ayearmon, DATA, DATA-100 as rate
from test
where isvalid=1 and code='3502'
and region = '000000'
order by ayearmon desc
) c) v3,
(
select (rownum-1) as rn1, d.* from (
select ayearmon, DATA
from test
where isvalid=1 and code='3502'
and region = '000000'
order by ayearmon desc
) d) v4
where v1.rn = v2.rn1 and v3.rn = v4.rn1 and v1.rn = v3.rn
and v1.rn >= 1 and v1.rn <= 10
和
select * from (
select v1.*, CASE WHEN substr(v1.ayearmon, 5, 2) = '02' THEN v1.DATA ELSE (v1.DATA - v2.DATA) END as dy
from (
select rownum as rn, a.* from (
select ayearmon, DATA
from v_yy_MAC201
where isvalid=1 and code='10011001' and length(ayearmon) = 6
and timetype='b0301' and region = '000000'
order by ayearmon desc
) a) v1,
(
select (rownum-1) as rn1, b.* from (
select ayearmon, DATA
from v_yy_MAC201
where isvalid=1 and code='10011001' and length(ayearmon) = 6
and timetype='b0301' and region = '000000'
order by ayearmon desc
) b) v2 where v1.rn = v2.rn1
)
where rn >= 1 and rn <= 50
通过上面的2个sql,能不能发现什么规律呢?
有空继续讨论。
- ORA-00918: column ambiguously defined错误应对方法
- ORA-00918: column ambiguously defined
- ORA-00918: column ambiguously defined
- ORA-00918: column ambiguously defined
- ORA-00918: column ambiguously defined
- ORA-00918 column ambiguously defined
- ORA-00918: column ambiguously defined
- ORA-00918: column ambiguously defined解决之道
- ORA-00918: column ambiguously defined 未明确定义列
- column ambiguously defined
- oracle: column ambiguously defined
- springMVC+ibaties 分页查询数据时 提示错误 将语句复制到数据库进行编译 报错为ORA-00918: column ambiguously defined
- [Hibernate]"column ambiguously defined"异常
- 数据库分页查询报错:ORA_00923:column ambiguously defined 某列定期模糊
- 错误提示:ORA-01747: user.table.column, table.column 或列说明无效
- 错误提示:ORA-01747: user.table.column, table.column 或列说明无效
- ora-02069 错误处理方法
- js,java,浮点数运算错误及应对方法
- Android中ListView的onKeyDown、onKeyUp、onKeyMultiple事件的处理流程
- SQL server 2005还原错误
- 虚拟目录中的web.config不被上级目录的web.config影响的处理
- verilog设计经验点滴
- ubuntu10.10下QQ安装和自动退出BUG解决
- ORA-00918: column ambiguously defined错误应对方法
- 项目管理-人力资源管理-人力资源管理计划-工具-RACI矩阵-Responsible与Accountable的区别
- mysql str_to_date字符串转换为日期
- JBPM 4表说明
- 使用phpExcelReader读取excel文件
- strcpy函数
- 别让直觉做决定 克服做决定时常见错误!
- 随便说说
- UDP流量控制之分析