gpt4 book ai didi

sql - ORA-21700 : object does not exist or is marked for delete

转载 作者:行者123 更新时间:2023-12-05 08:09:50 27 4
gpt4 key购买 nike

我有 Period 和 TableOfPeriod 类型的包:

  TYPE Period
IS RECORD
( StartPeriod Date,
EndPeriod Date
);

TYPE TableOfPeriod
IS TABLE OF Period;

在这个包中我有三个简单的函数:

  FUNCTION Temp1
RETURN TableOfPeriod IS
returnedValue TableOfPeriod := TableOfPeriod();
BEGIN
returnedValue.extend(1);
returnedValue(1).StartPeriod := sysdate-100;
returnedValue(1).EndPeriod := sysdate;
RETURN returnedValue;
END Temp1;

FUNCTION CalculateFine
return VARCHAR2
IS
freewillLockTableRP TableOfPeriod:=TableOfPeriod();
compulsoryLockTableRP TableOfPeriod:=TableOfPeriod();

BEGIN

--for testing
compulsoryLockTableRP:=Temp1();
FOR i IN compulsoryLockTableRP.FIRST..compulsoryLockTableRP.LAST LOOP
IF(((compulsoryLockTableRP(i).EndPeriod - compulsoryLockTableRP(i).StartPeriod)>1)) THEN
BEGIN
-- RAISE_APPLICATION_ERROR(-20001, 'Hello world');
SELECT T111.StartPeriod StartPeriod,
T111.EndPeriod EndPeriod
bulk collect into freewillLockTableFull
FROM TABLE(DistributeDaysByPeriods(compulsoryLockTableRP, 5)) T111;
END;
END IF;
END LOOP;
/*SELECT T111.StartPeriod StartPeriod,
T111.EndPeriod EndPeriod
-- BULK COLLECT INTO compulsoryLockTableRP
bulk collect into freewillLockTableFull
FROM TABLE(DistributeDaysByPeriods(compulsoryLockTableRP, 5)) T111;*/
--===========

--SOME OTHER PROCESSING


RETURN 'Ok '
|| '#r';




EXCEPTION
WHEN No_Data_Found THEN return 'No data found#g';
-- WHEN OTHERS THEN RETURN SQLERRM;

END CalculateFine;

当我执行这个函数时,我有下一个错误:

"ORA-21700: object does not exist or is marked for delete ORA-06512: at "MyPackageName", line 1181 ORA-06512: at line 1 21700. 00000 - "object does not exist or is marked for delete""

其中1181行是CalculateFine函数的Select语句所在的行。谁能告诉我,出了什么问题以及我该如何解决这个问题?

最佳答案

检查您的包所在的同一文件夹中是否有同名但扩展名为 *.~sql 的文件(例如:your_file_name.~sql)。我有同样的错误,但在我删除了一个 *.~sql 文件后,我可以编译我的包而没有 ORA 错误。

关于sql - ORA-21700 : object does not exist or is marked for delete,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31590096/

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