gpt4 book ai didi

sql - 01403. 00000 - "no data found"

转载 作者:行者123 更新时间:2023-12-02 07:30:19 25 4
gpt4 key购买 nike

我正在更新我的 docmeta 表,但我得到了

ORA-01403: 未找到数据ORA-06512: 在第 25 行01403. 00000 - “未找到数据”错误

下面是查询。我怎样才能摆脱这个错误?

DECLARE 
varPayTerm varchar2(300);
BEGIN
FOR X IN(
SELECT
d.did, d.xproject_id
FROM
revisions r,
(SELECT DDOCNAME, MAX(DID) mDID
FROM
REVISIONS REV
WHERE
dcreatedate >='01-Jan-14'
GROUP BY
DDOCNAME
) RevLatestID,
docmeta d
--temp_project p
WHERE
RevLatestID.mdid = r.did
and d.did = r.did
)
loop

select paymentterm
into varPayTerm
from project where pid = X.xproject_id and paymentterm is not null;

update docmeta
set xpaymentterm= varPayTerm
where did=X.dID
and xproject_id = X.xproject_id;
END LOOP;
END ;

最佳答案

SELECT...INTO 语句不返回任何行
如果不返回任何行是有效的,并且您想继续,您可以捕获并忽略 NO_DATA_FOUND 异常,如下所示:

   ...
BEGIN
SELECT ... INTO...;
EXCEPTION
WHEN NO_DATA_FOUND THEN
paymentterm := 0;
-- or ant msg you want
then return 'no data here';
END;
...

关于sql - 01403. 00000 - "no data found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22531260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com