title: The use of sql%notfound on implicit cursor
body: <p>I'm completely new to oracle PLSQL. Any help is appreicated. </p>
  
  <p>I could not find similiar question on SO (Maybe it's too basic?)</p>
  
  <p>I'm running the code from TOAD,   Oracle 11G</p>
  
  <pre><code>SET SERVEROUTPUT ON
  DECLARE 
  var titres%ROWTYPE; 
  BEGIN
      select reference, sicovam into
      var.reference, var.sicovam 
      from titres 
      where reference = '1234';
      if sql%notfound then 
          dbms_output.put_line('NOT FOUND');
      else 
          dbms_output.put_line(var.reference || '    ' ||  var.sicovam);
      end if;
  END;
  </code></pre>
  
  <p>If the <code>Where</code> Clause can extract one row of data, then it will run the <code>else</code> part</p>
  
  <p>If the <code>Where</code> Clause cannot extract any row, then it will display the error:</p>
  
  <pre><code>ORA-01403: no data found
  ORA-06512: at line 4
  </code></pre>
  
  <p>Can anyone point me in the right direction? Thanks</p>
  
  <p>I have tried using the basic exception handling code </p>
  
  <pre><code>When others then 
  null;
  end;
  </code></pre>
  
  <p>Then I am getting another strange result:
  If the <code>Where</code> Clause can extract one row of data, then it will NOT run the <code>else</code> part or the <code>if</code> part.</p>