ORA-21700:对象不存在或标记为删除

时间:2015-07-23 14:18:43

标签: sql oracle

我有包含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:对象不存在或标记为删除ORA-06512:   在“MyPackageName”,第1181行ORA-06512:在第1行   21700. 00000 - “对象不存在或标记为删除”“

其中1181行是带有CalculateFine函数的Select语句的行。任何人都可以告诉我,什么是错的以及我如何解决这个问题?

1 个答案:

答案 0 :(得分:-1)

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