title: oracle procedure error PLS-00103 Encountered the symbol "END"
body: <p>I get the following error:</p>
  
  <blockquote>
    <p>58/6     PLS-00103: Encountered the symbol "END" when expecting one of
    the       following:                                                  </p>
    
    <p>begin function pragma procedure subtype type <br>
     current cursor delete<br>
    exists prior</p>
  </blockquote>
  
  <p>Anyone have any idea what I am missing?</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE VALIDATE_BI_JOB_COMPLETE_PROC AS
  
  msg           SYS.XMLTYPE;
  msg_props     DBMS_AQ.MESSAGE_PROPERTIES_T;
  msg_id        RAW(16);
  queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
  rec_count     INTEGER;
  /******************************************************************************
     NAME:         VALIDATE_BI_JOB_COMPLETE_PROC
   *******************************************************************************
  
  BEGIN
  
  INSERT INTO JOB_LOG
    (JOB_NAME, JOB_SEQUENCE, RUN_DATE, LINE_SEQ_NO, LOG_TXT)
  VALUES
    ($$PLSQL_UNIT, 1, SYSDATE, 1, 'Job Started at ' || to_char(sysdate, 'MM/DD/YYYY HH:MI:SS'));
  COMMIT;
  
  rec_count := 0;
  
     SELECT COUNT(*) INTO rec_count
         FROM  SCHEDULED_JOBS
         WHERE JOB_NAME IN ('bi_get_transactional_data', 'bi_get_reference_data') AND
               CURRENTLY_PROCESSING_FLG = 'Y';
  
      IF rec_count &gt; 0 THEN
        BEGIN
          DECLARE CURSOR email IS
          SELECT EMAIL_ID
            FROM ERROR_EMAIL_NOTIFICATION
           WHERE ACTIVE = 'Y' AND
            SEVERITY_CD = 'ERROR';
  
           vFROM    VARCHAR2(30) := 'WORK_SYSTEM@XXX.COM';
           vTYPE    VARCHAR2(30) := 'text/plain; charset=us-ascii';
           msg_body VARCHAR2(4000) := 'BI jobs are still running, please investigate.
           bi_get_transactional_data, bi_get_reference_data)';
  
        crlf      CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
  
        FOR email_rec IN email
           LOOP
             utl_mail.send(vFROM, email_rec.EMAIL_ID, NULL, NULL, ora_database_name || ': ' , 
             msg_body, vTYPE, NULL);
           END LOOP;
      END;
  
   END IF;
  
  INSERT INTO JOB_LOG
    (JOB_NAME, JOB_SEQUENCE, RUN_DATE, LINE_SEQ_NO, LOG_TXT)
  VALUES
    ($$PLSQL_UNIT, 2, SYSDATE, 1, 'Job Ended at ' || to_char(sysdate, 'MM/DD/YYYY HH:MI:SS')  || 
    '.  Records sent to JSSO: ' || rec_processed);
  COMMIT;
  
   -- exception processing goes here
  
   EXCEPTION
          WHEN OTHERS THEN
               LOG_ERROR(
                  p_APP_ID       =&gt; 'ORACLE',
                  p_SEVERITY_CD  =&gt; 'ERROR',
                  p_ROUTINE_NAME =&gt; $$PLSQL_UNIT,
                  p_BACKTRACE    =&gt; DBMS_UTILITY.FORMAT_ERROR_BACKTRACE,
                  p_SQL_CODE     =&gt; SQLCODE,
                  p_LOG_TXT      =&gt; SQLERRM,
                  p_HOST_ID      =&gt; SYS_CONTEXT('userenv', 'host'),
                  p_USER_ID      =&gt; SYS_CONTEXT('userenv', 'session_user'),
                  p_SESSION_ID   =&gt; SYS_CONTEXT('userenv', 'sid'));
  
          INSERT INTO JOB_LOG
              (JOB_NAME, JOB_SEQUENCE, RUN_DATE, LINE_SEQ_NO, LOG_TXT)
           VALUES
              ($$PLSQL_UNIT, 2, SYSDATE, 1, 'Job ABENDED at ' || to_char(sysdate, 'MM/DD/YYYY 
              HH:MI:SS') || '.  Error condtion.');
  COMMIT;
  
  END;
  /
  </code></pre>