title: Oracle Last Records from Cursor
body: <p>I have the following piece of code. For the last line of the cursor I don't need to print the '->' symbol. If you run the query you can see that the fourth record is displayed twice </p>
  
  <pre><code>declare
  cursor ch is
    select 1 as n from dual union
    select 2 from dual union 
    select 3 from dual union
    select 4 from dual;
  v_ch ch%rowtype;
  begin
  
    open ch;
    loop
      fetch ch into v_ch;
      exit when ch%notfound;
      dbms_output.put_line(LPAD(' ',5)||v_ch.n || '-&gt;');
  
    end loop;
    dbms_output.put_line(LPAD(' ',5)||v_ch.n);
    close ch;
  end;
  </code></pre>
  
  <p>result</p>
  
  <pre><code> 1-&gt;
   2-&gt;
   3-&gt;
   4-&gt;
   4
  </code></pre>