我执行一个SQL,
update irpt_departments a set (a.dept_code,a.dept_class,a.tx_dz)=
(select b.dept_code,b.dept_class,b.tx_dz from irpt_departments b where a.Id=b.parent and b.isjc='0' And b.caption Like '%基层户')
where exists (select 1 from irpt_departments b where a.Id=b.parent and b.isjc='0' and b.caption Like '%基层户' ) And a.isjc='9';
有的地方执行没事,有的地方执行提示
ORA-01427: 单行子查询返回多个行 这个问题怎么解决呢?多谢:)
update irpt_departments a set (a.dept_code,a.dept_class,a.tx_dz)=
(select b.dept_code,b.dept_class,b.tx_dz from irpt_departments b where a.Id=b.parent and b.isjc='0' And b.caption Like '%基层户')
where exists (select 1 from irpt_departments b where a.Id=b.parent and b.isjc='0' and b.caption Like '%基层户' ) And a.isjc='9';
有的地方执行没事,有的地方执行提示
ORA-01427: 单行子查询返回多个行 这个问题怎么解决呢?多谢:)
解决方案 »
- 存储过程写法问题
- 复杂查询
- 问个动态交叉表的写法
- 使用rman,恢复的控制文件所包含的备份信息不全,导致恢复无法正常进行。 请指教!
- 我SYS用户登陆,通过SQL,能否删除某个用户建立的所有表?
- 我是oracle新手,装了oracle817后,现在想重新装一遍,但是为什么找不到oracle的卸载程序啊,请问该怎么样卸载啊
- 图片如何很好地保存进数据库进行管理?
- 请各位高手赐教!!
- oracle 用IMP命令导入后,为什么原来表的扩展属性看不到了?急!!!
- 急!!天啊,难道没有人知道怎样让linux下的Oracle8.1.6支持中文吗?再增100分求教!!!
- 在oracle触发器中如何得到“当前”更新的行数据
- 请教:ORA-03115: 不支持的网络数据类型或表示法
在 set (a.dept_code,a.dept_class,a.tx_dz)=....这里查询返回了多个值,当然没法用=去匹配。
select b.dept_code,b.dept_class,b.tx_dz from irpt_departments b where a.Id=b.parent and b.isjc='0' And b.caption Like '%基层户')
where exists (select 1 from irpt_departments b where a.Id=b.parent and b.isjc='0' and b.caption Like '%基层户' ) And a.isjc='9'有多个值.....这当然不行...
改成下面的试试:
UPDATE IRPT_DEPARTMENTS A
SET (A.DEPT_CODE, A.DEPT_CLASS, A.TX_DZ) = (SELECT B.DEPT_CODE,
B.DEPT_CLASS,
B.TX_DZ
FROM IRPT_DEPARTMENTS B
WHERE A.ID = B.PARENT
AND B.ISJC = '0'
AND B.CAPTION LIKE '%基层户'
AND ROWNUM = 1)
WHERE EXISTS (SELECT 1
FROM IRPT_DEPARTMENTS B
WHERE A.ID = B.PARENT
AND B.ISJC = '0'
AND B.CAPTION LIKE '%基层户'
AND ROWNUM = 1)
AND A.ISJC = '9';
select szxm from CBLY1.LY_AZR , cbly1.ly_mdxx , cbly1.ly_mdyd
WHERE( cbly1.ly_mdxx.MDBH=CBLY1.LY_MDYD.MDBH and CBLY1.LY_MDYD.LM_CODE=CBLY1.LY_AZR.LM_CODE
and ((select mWflmc||mWFLdm from chaobai_2v.mwdmxx) in(select mdflmc||mddmmc from CBLY1.ly_mdxx))
and rownum=1
select szxm from CBLY1.LY_AZR , cbly1.ly_mdxx , cbly1.ly_mdyd
WHERE( cbly1.ly_mdxx.MDBH=CBLY1.LY_MDYD.MDBH and CBLY1.LY_MDYD.LM_CODE=CBLY1.LY_AZR.LM_CODE
and ((select mWflmc||mWFLdm from chaobai_2v.mwdmxx) in(select mdflmc||mddmmc from CBLY1.ly_mdxx))
and rownum=1单行子查询返回多个行 这个问题怎么解决呢?