ORA-00913:值过多

2024-12-23 06:42:05
推荐回答(4个)
回答1:

改成这个样子. 把 A3.* 改成 A3.CTN_NO
SELECT ctn_operator_code, ctn_type, ctn_size, COUNT (ctn_no)
FROM vsp_voyage_plan a1, vsp_vessel_info a2, act_inventory a3
WHERE a3.ctn_no IN (
SELECT a3.a3.ctn_no
FROM vsp_voyage_plan a1, vsp_vessel_info a2, act_inventory a3
WHERE a2.vessel_namec = '中远日本'
AND a1.inbound_voyage = '441W'
AND a3.actual_position_qualifer = 'Y'
AND a1.vessel_code = a2.vessel_code)

问题出在 where A3.CTN_NO in (select A3.* ...
因为你 A3.CTN_NO 是一个字段.而后面查询的结果是整个记录集,其中包含多列.因此会识别不出A3.CTN_NO所对应的列来,就报错了.

回答2:

where A3.CTN_NO in
(select A3.* from vsp_voyage_plan A1, vsp_vessel_info A2, act_inventory A3
where A2.VESSEL_NAMEC='中远日本' and
A1.INBOUND_VOYAGE='441W' and
A3.ACTUAL_POSITION_QUALIFER='Y' and
A1.VESSEL_CODE=A2.VESSEL_CODE )

A3.CTN_NO 是一个字段 后面in一个表的肯定不行。
select A3.CTN_NO from vsp_voyage_plan A1,。。。。

对于补充的问题,你能告诉我你的count
(CTN_NO)是做什么用的么?因为实在看不出你的意图没法给你改啊

回答3:

运行这个试试
select CTN_OPERATOR_CODE, CTN_TYPE, CTN_SIZE, count(CTN_NO)
from vsp_voyage_plan A1, vsp_vessel_info A2, act_inventory A3
where A3.CTN_NO in
(select A3.CTN_NO
from vsp_voyage_plan A1, vsp_vessel_info A2, act_inventory A3
where A2.VESSEL_NAMEC = '中远日本'
and A1.INBOUND_VOYAGE = '441W'
and A3.ACTUAL_POSITION_QUALIFER = 'Y'
and A1.VESSEL_CODE = A2.VESSEL_CODE)

回答4:

详情请参考 www.zhuangbility.com.cn