【发布时间】:2021-01-18 06:47:41
【问题描述】:
我收到 ORA-1422 错误。这是错误:
连接到数据库 Quantum Train。 ORA-01422: 精确提取返回的行数多于请求的行数 ORA-06512:在“TRAIN.UPDATE_MASTER_TO_NULL”,第 26 行 ORA-06512: 在第 2 行 进程退出。 断开与数据库 Quantum Train 的连接。
PROCEDURE UPDATE_MASTER_TO_NULL
is
-- This gets the pnm_auto_keys for the records in the warehouse and location with the specified manufacturer
Cursor Csr is
Select pnm.loc_auto_key
from parts_master pnm join warehouse whs on pnm.whs_auto_key = whs.whs_auto_key
where whs.warehouse_code = 'SHOP' and
pnm.loc_auto_key <> '39';
-- pnm.loc_auto_key <> '39' and
-- pnm.loc_auto_key <> '26' and
-- pnm.loc_auto_key <> '14';
loc_key integer;
Begin
For i in Csr Loop
-- Now get the loc_auto_key for your new location
Select loc2.loc_auto_key
into loc_key
From PARTS_MASTER loc2
Where loc2.loc_auto_key is null;
-- Assigne the new loc_auto_key to the selected record.
Update parts_master pnm2
Set pnm2.loc_auto_key = loc_key
where pnm2.loc_auto_key = i.loc_auto_key;
End Loop;
Commit;
End UPDATE_MASTER_TO_NULL;
谢谢,
杰夫
【问题讨论】:
-
this 有帮助吗?您在
SELECT INTO..中选择了不止一行。 -
如果我不得不做一个疯狂的猜测,你是不是忘了把 where 子句从
PARTS_MASTER选择为loc2.loc_auto_key = i.loc_auto_key? -
我认为我返回的行数不超过 1 行。我在这个中看到了 where 子句。
-
该查询应该找到什么?选择列表和 where 子句引用同一列,因此它只能返回零个、一个或多个空值。评论指的是“新位置”,所以您是否应该在其他列上进行过滤?
-
我认为这是问题所在。我正在更新的同一字段中查找数据。我无法真正更新不同的标准。
标签: oracle plsqldeveloper