有没有大神指点一下SQL语句错哪了?显示单行子查询返回多个行

deletefrombdc_cwhereljzid='2380';insertintobdc_c(cid,sjc,myc,xmid,zrzid,ljzid)select'... delete from bdc_c where ljzid = '2380';
insert into bdc_c
(cid, sjc, myc, xmid, zrzid, ljzid)
select 'XC_' || cid CID,
sjc SJC,
sjc MYC,
xmid XMID,
zrzid ZRZID,
ljzid LJZID
from (select (select case
when max_cid is null then
0
else
max_cid
end
from (select max(to_number(replace(cid, 'XC_', ''))) max_cid
from bdc_c
where cid like 'XC_%')) + rownum cid,
sjc,
xmid,
zrzid,
ljzid
from (select sjc, xmid, zrzid, ljzid
from (select sjc, xmid, zrzid, ljzid
from bdc_h
where ljzid = '2380')
group by sjc, xmid, zrzid, ljzid
order by sjc));
update bdc_h h
set h.cid = (select c.cid
from bdc_c c
where h.sjc = c.sjc
and ljzid = '2380')
where ljzid = '2380';
展开
 我来答
苗晓强1991的家
2017-09-01 · TA获得超过488个赞
知道小有建树答主
回答量:1287
采纳率:42%
帮助的人:178万
展开全部
说明你有个条件查询子句,返回多个结果,所以才会报错
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式