我正在更新我的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 ;
答案 0 :(得分:5)
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;
...