我有这个过程,它只是根据名为AppID
. AppNbr
此过程从基于该行列调用的另一列中获取一个值AppID
。该过程TOO_MANY_ROWS
在尝试SELECT
一行时失败并出现异常。这是 PL/SQL:
DECLARE
lvnApplNbr NUMBER;
PROCEDURE deleteAppl(applId IN VARCHAR2) IS
BEGIN
BEGIN
SELECT ApplNbr -- Exception thrown here
INTO lvnApplNbr
FROM Appl
WHERE ApplID = applId;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
-- ... Delete it after some logic
END; -- End Procedure
BEGIN
...
deleteAppl('571E00BA-70E6-4523-BEAC-4568C3DD1A7D');
...
END;
sTOO_MANY_ROWS
时抛出异常。SELECT INTO
我不知道它为什么会抛出那个错误,因为如果我只是查询这个:
SELECT ApplNbr FROM Appl WHERE ApplId = '571E00BA-70E6-4523-BEAC-4568C3DD1A7D';
只有一排会返回正确的ApplId
.
到底是怎么回事?