title: no_data_found exception in oracle pl/sql while using collection
body: <pre><code>DECLARE
     TYPE EmpList IS TABLE OF varchar2(50) INDEX BY BINARY_INTEGER;
  
     temp    SYS_REFCURSOR;
     v_temp  varchar2(50);
     v_emp   EmpList;
  BEGIN
     v_emp (1) := 'gaurav';
     v_emp (2) := 'manu';
  
     open temp for select v_emp(level) from dual connect by level&lt;=2;
     loop
      fetch temp into v_temp;
       exit when temp%notfound;
         DBMS_OUTPUT.put_line (v_temp);
      end loop;
     close temp;
  
  --the below part works, then why not the above part dint works
   for i in v_emp.first..v_emp.last
    loop
        dbms_output.put_line(v_emp(i));
    end loop;
  
  EXCEPTION
     WHEN OTHERS
     THEN
        DBMS_OUTPUT.put_line (SQLERRM);
  END;
  </code></pre>
  
  <p>Can anyone please tell me why this collection dint work here??,It is giving me no_data_found exception.</p>