title: Loop index variable use is invalid in PL/SQL Collections
body: <p>After I'm executing this I receive the following:</p>
  
  <pre><code>PL/SQL: ORA-00942: table or view does not exist
  PLS-00364: loop index variable 'EMP_REC' use is invalid
  </code></pre>
  
  <p>It is said that: </p>
  
  <blockquote>
    <p>In a block or subprogram, user-defined records are instantiated when you enter the block or Subprogram. They cease to exist when you exit the block Subprogram."</p>
  </blockquote>
  
  <p>Now I think I fully understand what it is saying, I think... But along with this said, is it supposed my FOR section to work right?(why it isn't?), because as I can see, the whole things happen in the block not outside. So till the exit of the block I suppose that v_myrec to exist in the cache or buffer of the private memory allocated by the Oracle server by default because after all v_myrec is a "table" so to speak, therefore the DBMS package should be able to print my "emp_rec.v_sal..." and after the execution of my block completes successfully, THEN v_myrec ceases to exist. I'm little confused here, can anybody explain me this? </p>
  
  <p>If I got it all wrong please correct me. v</p>
  
  <pre><code>DECLARE
   TYPE t_rec IS RECORD
    (v_sal           NUMBER(8) NOT NULL := 0,
     v_min_sal       NUMBER(8) DEFAULT 1000,
     v_hire_date     employees.hire_date%TYPE,
     v_rec1          employees%ROWTYPE);
   v_myrec t_rec;  
  BEGIN
   v_myrec.v_sal := v_myrec.v_min_sal + 500;
   v_myrec.v_hire_date := SYSDATE;
    SELECT *
    INTO v_myrec.v_rec1
    FROM employees
    WHERE employee_id = 100;
   DBMS_OUTPUT.PUT_LINE(v_myrec.v_rec1.last_name||' '||v_myrec.v_sal||
                        ' '||v_myrec.v_rec1.salary);
  
   FOR emp_rec IN (SELECT *
                          FROM v_myrec)   
   LOOP
   DBMS_OUTPUT.PUT_LINE(emp_rec.v_sal,...,...);                
   END LOOP;
  END;
  </code></pre>