title: Why do we need BEGIN END (execution section) in last portion for an Anonymus block?
body: <p>When I try to run this code</p>
  <pre><code>DECLARE
  TYPE type_a IS
      TABLE OF NUMBER INDEX BY PLS_INTEGER;
  output NUMBER := 1;
  
  FUNCTION fun_2 RETURN type_a IS
      dum type_a;
  BEGIN
      SELECT
          employee_id
      BULK COLLECT
      INTO dum
      FROM
          employees;
  
      RETURN dum;
  END fun_2;
  
  PROCEDURE proc_1 AS
  BEGIN
      NULL;
  END;
  </code></pre>
  <p>I am getting below error:</p>
  <blockquote>
  <p>Error report - ORA-06550: line 22, column 8: PLS-00103: Encountered
  the symbol &quot;end-of-file&quot; when expecting one of the following:</p>
  <p>begin function pragma procedure
  06550. 00000 -  &quot;line %s, column %s:\n%s&quot;
  *Cause:    Usually a PL/SQL compilation error.
  *Action:</p>
  </blockquote>
  <p>But when i add BEGIN END  at last its working fine</p>
  <pre><code>    DECLARE
      TYPE type_a IS
          TABLE OF NUMBER INDEX BY PLS_INTEGER;
      output NUMBER := 1;
  
      FUNCTION fun_2 RETURN type_a IS
          dum type_a;
      BEGIN
          SELECT
              employee_id
          BULK COLLECT
          INTO dum
          FROM
              employees;
  
          RETURN dum;
      END fun_2;
  
      PROCEDURE proc_1 AS
      BEGIN
          NULL;
      END;
  
  BEGIN
      null ;
  END;
  </code></pre>
  <p>I got the answer but Why is this ? I mean How the code is being executed and why is it needed?</p>