ORA-06550:第1行第7列:PLS-00905:对象DMQ1STG.CPS_SCHEDULE_SETUP_PROCESS无效

时间:2016-12-15 13:21:21

标签: plsql

我试图执行此过程,但错误对象无效 用户有足够的权限..请帮助

CREATE OR REPLACE PROCEDURE CPS_SCHEDULE_SETUP_PROCESS
IS
   CURSOR cpsSCHEDULErecords
   IS
      SELECT *
        FROM cps_schedule_setup
       WHERE active = 'Yes' AND complete = 'No';--decode(recurring,'Yes',end_date +  3 + 3.335/4, end_date +  1 + 3.335/4 ) <= sysdate and   end_date + 1 + 1/3 <= sysdate and  NVL(schedule_date,SYSDATE) <= sysdate;  

   nWorkList     INTEGER := 0;

   nSchedule     INTEGER := 0;

   dNewEndDT     DATE;

   dNewStartDT   DATE;
BEGIN
   FOR rec IN cpsSCHEDULErecords
   LOOP
      DBMS_OUTPUT.PUT_LINE (
            ' Processing - ClientNum: '
         || TO_CHAR (rec.CLIENT_NUM)
         || ' StartDT: '
         || TO_CHAR (rec.START_DATE)
         || ' EndDT: '
         || TO_CHAR (rec.END_DATE));

      IF rec.RESCHEDULE_DATE IS NULL
      THEN
         BEGIN
            CPS_OVERRIDE_UPDATE_SR_FACT (rec.CLIENT_NUM,
                                         'N',
                                         rec.START_DATE,
                                         rec.END_DATE);
         EXCEPTION
            WHEN OTHERS
            THEN
               DBMS_OUTPUT.PUT_LINE (
                  'Error:' || SQLCODE || ' Msg: ' || SQLERRM);
               RAISE;
         END;

         SELECT COUNT (*)
           INTO nWorkList
           FROM CPS_CONTENT_MASTER
          WHERE     CLIENT_NUM = rec.CLIENT_NUM
                AND AGREEMENT_NUM = rec.AGREEMENT_NUM
                AND START_DATE = rec.START_DATE
                AND END_DATE = rec.END_DATE;

         IF nWorkList = 0
         THEN
            INSERT INTO CPS_CONTENT_MASTER
                 VALUES (CPS_CONTENT_MASTER_SEQ.NEXTVAL,
                         rec.CLIENT_NUM,
                         rec.AGREEMENT_NUM,
                         rec.FREQUENCY,
                         rec.START_DATE,
                         rec.END_DATE,
                         'Inserting AUTHOR SAVE',
                         'AUTHOR SAVE',
                         SYSDATE,
                         'CPS proc',
                         rec.CONTENT_TYPE,
                         rec.LANG_ID);
         ELSE
            UPDATE CPS_CONTENT_MASTER
               SET STATUS = 'AUTHOR SAVE'
             WHERE     CLIENT_NUM = rec.CLIENT_NUM
                   AND AGREEMENT_NUM = rec.AGREEMENT_NUM
                   AND START_DATE = rec.START_DATE
                   AND END_DATE = rec.END_DATE;
         END IF;
      END IF;

      IF rec.RESCHEDULE_DATE IS NOT NULL
      THEN
         BEGIN
            SR_FACT_RESET (rec.CLIENT_NUM,
                           'Y',
                           rec.START_DATE,
                           rec.END_DATE);
         EXCEPTION
            WHEN OTHERS
            THEN
               DBMS_OUTPUT.PUT_LINE (
                  'Error:' || SQLCODE || ' Msg: ' || SQLERRM);

               RAISE;
         END;



         BEGIN
            CPS_SR_DETAIL_NULL (rec.CLIENT_NUM,
                                NULL,
                                rec.START_DATE,
                                rec.END_DATE);
         EXCEPTION
            WHEN OTHERS
            THEN
               DBMS_OUTPUT.PUT_LINE (
                  'Error:' || SQLCODE || ' Msg: ' || SQLERRM);

               EXIT;
         END;



         SELECT COUNT (*)
           INTO nWorkList
           FROM CPS_CONTENT_MASTER
          WHERE     CLIENT_NUM = rec.CLIENT_NUM
                AND AGREEMENT_NUM = rec.AGREEMENT_NUM
                AND START_DATE = rec.START_DATE
                AND END_DATE = rec.END_DATE;

         IF nWorkList = 0
         THEN
            INSERT INTO CPS_CONTENT_MASTER
                 VALUES (CPS_CONTENT_MASTER_SEQ.NEXTVAL,
                         rec.CLIENT_NUM,
                         rec.AGREEMENT_NUM,
                         rec.FREQUENCY,
                         rec.START_DATE,
                         rec.END_DATE,
                         'Inserting AUTHOR SAVE',
                         'AUTHOR SAVE',
                         SYSDATE,
                         'CPS proc',
                         rec.CONTENT_TYPE,
                         rec.LANG_ID);
         ELSE
            UPDATE CPS_CONTENT_MASTER
               SET STATUS = 'AUTHOR SAVE'
             WHERE     CLIENT_NUM = rec.CLIENT_NUM
                   AND AGREEMENT_NUM = rec.AGREEMENT_NUM
                   AND START_DATE = rec.START_DATE
                   AND END_DATE = rec.END_DATE;
         END IF;
      END IF;

      -- ADDED TO PROCESS CMR REPORTS

      BEGIN
         DBMS_OUTPUT.PUT_LINE ('Now Executing LOAD_MONTH_REPORT ..');

         LOAD_MONTH_REPORT (rec.CLIENT_NUM,
                            rec.AGREEMENT_NUM,
                            rec.START_DATE,
                            rec.END_DATE);

         DBMS_OUTPUT.PUT_LINE ('Now Executing LOAD_SR_AVAILABILITY_RPT ..');

         LOAD_SR_AVAILABILITY_RPT (rec.CLIENT_NUM,
                                   rec.AGREEMENT_NUM,
                                   rec.START_DATE,
                                   rec.END_DATE);

         DBMS_OUTPUT.PUT_LINE ('Now Executing LOAD_SR_CLOSE_RPT ..');

         LOAD_SR_CLOSE_RPT (rec.CLIENT_NUM,
                            rec.AGREEMENT_NUM,
                            rec.START_DATE,
                            rec.END_DATE);

         DBMS_OUTPUT.PUT_LINE ('Now Executing LOAD_SR_RESPONSE_RPT ..');

         LOAD_SR_RESPONSE_RPT (rec.CLIENT_NUM,
                               rec.AGREEMENT_NUM,
                               rec.START_DATE,
                               rec.END_DATE);
      EXCEPTION
         WHEN OTHERS
         THEN
            RAISE;
      END;

      -- END

      DBMS_OUTPUT.PUT_LINE (
         'Trying to UPDATE CPS_SCHEDULE_SETUP to COMPLETE ..');

      UPDATE CPS_SCHEDULE_SETUP
         SET COMPLETE = 'Yes', COMPLETED_DATE = SYSDATE
       WHERE SCHEDULE_ID = rec.SCHEDULE_ID;



      DBMS_OUTPUT.PUT_LINE ('Trying to handle RECURRING cases ..');


      IF rec.RECURRING = 'Yes'
      THEN
         dNewStartDT := rec.END_DATE + 1;

         IF rec.FREQUENCY = 'MONTHLY'
         THEN
            dNewEndDT := ADD_MONTHS (dNewStartDT, 1) - 1;
         ELSIF rec.FREQUENCY = 'QUARTERLY'
         THEN
            dNewEndDT := ADD_MONTHS ( (rec.END_DATE + 1), 3) - 1;
         ELSIF rec.FREQUENCY = 'WEEKLY'
         THEN
            dNewEndDT := dNewStartDT + 6;
         ELSE
            dNewEndDT := NULL;
         END IF;


         DBMS_OUTPUT.PUT_LINE ('NEW StartDT:' || TO_CHAR (dNewStartDT));

         DBMS_OUTPUT.PUT_LINE ('NEW EndDT:' || TO_CHAR (dNewEndDT));

         SELECT COUNT (*)
           INTO nSchedule
           FROM CPS_SCHEDULE_SETUP
          WHERE     CLIENT_NUM = rec.CLIENT_NUM
                AND AGREEMENT_NUM = rec.AGREEMENT_NUM
                AND START_DATE = dNewStartDT
                AND END_DATE = dNewEndDT;

         IF nSchedule > 0
         THEN
            NULL;
         ELSE
            INSERT INTO CPS_SCHEDULE_SETUP
                 VALUES (CPS_SCHEDULE_SETUP_SEQ.NEXTVAL,
                         rec.CLIENT_NUM,
                         rec.AGREEMENT_NUM,
                         dNewStartDT,
                         rec.FREQUENCY,
                         dNewEndDT,
                         rec.CONTENT_TYPE,
                         'Yes',
                         'No',
                         'Yes',
                         NULL,
                         NULL,
                         SYSDATE,
                         rec.LANG_ID);
         END IF;
      END IF;

      COMMIT;
   END LOOP;
-- close cpsSCHEDULErecords;

EXCEPTION
   WHEN OTHERS
   THEN
      ROLLBACK;

      DBMS_OUTPUT.PUT_LINE (
         'Error during CPS_SCHEDULE_SETUP_PROCESS execution ..');

      DBMS_OUTPUT.PUT_LINE (
         'Error Code:' || SQLCODE || '  Error Msg:' || SQLERRM);
END;

1 个答案:

答案 0 :(得分:1)

ORA-06550错误是一般的PL/SQL编译错误。该错误指向发生语法错误的PL/SQL中的位置。请检查代码中的所有objects是否为valid并尝试recompile代码。从您的错误中我可以看到对象DMQ1STG.CPS_SCHEDULE_SETUP_PROCESS无效。