title: PLS-00103: Encountered the symbol "EXCEPTION" error while checking for a value in the bind variable
body: <p>I am getting the below error for the PL/SQL block I executed.</p>
  
  <blockquote>
    <p>ORA-06550: line 16, column 1: PLS-00103: Encountered the symbol
    "EXCEPTION" when expecting one of the following:<br><br></p>
  </blockquote>
  
  <p>My anonymous procedure below was working fine until I included the <code>user defined exception e_nonrented</code>. Which checks if the value of <code>bindvariable :g_movie_id=2..</code> If that is the case it throws an exception... </p>
  
  <p>Below is the code:</p>
  
  <pre><code>VARIABLE g_movie_id NUMBER EXEC :g_movie_id := 2
  DECLARE v_count NUMBER;
  v_movieid NUMBER;
  v_title mm_movie.movie_title%TYPE;
  e_nonrented
  
   EXCEPTION;
  BEGIN
    SELECT m.movie_title,
      COUNT(r.rental_id),
      r.movie_id
    INTO v_title,
      v_count,
      v_movieid
    FROM mm_movie m,
      mm_rental r
    WHERE m.movie_id = r.movie_id
     AND m.movie_id = :g_movie_id
    GROUP BY m.movie_title,
      r.movie_id;
    DBMS_OUTPUT.PUT_LINE(v_title || ': ' || v_count);
  
    IF :g_movie_id = 2 THEN
      RAISE e_nonrented;
  
    EXCEPTION
    WHEN no_data_found THEN
      DBMS_OUTPUT.PUT_LINE('there is no movie id for: ' || :g_movie_id);
    WHEN e_nonrented THEN
      DBMS_OUTPUT.PUT_LINE(' Movie with Id ');
    END;
  </code></pre>