title: Cursor of Oracle with Duplicate of final Record
body: <blockquote>
    <p>Why am getting duplicate records ? pls correct me.Thanks in Advance.</p>
  </blockquote>
  
  <pre><code>declare
    clazzes_rec clazzes%rowtype;
    cursor clazzes_cur is select * from clazzes;
  begin
    if clazzes_cur%isopen then
       dbms_output.put_line('Cursor is not open,trying to Open.... ... .. .');
    end if;
  
    open clazzes_cur;
  
    dbms_output.put_line('Cursor opened :');
  
    loop
      fetch clazzes_cur into clazzes_rec;
        dbms_output.put_line('id:'||clazzes_rec.id||':name:'||clazzes_rec.name);
      exit  when clazzes_cur%notfound;
    end loop;
  
    close clazzes_cur;
  
  end;
  </code></pre>
  
  <p><strong>Ouput :</strong></p>
  
  <pre><code>Cursor opened :
  id:1:name:leo1
  id:2:name:leo2
  id:3:name:leo3
  id:4:name:leo4
  id:4:name:leo4
  
  PL/SQL procedure successfully completed
  </code></pre>