title: How to raise exception in procedures?
body: <p>This is my procedure:</p>
  
  <pre><code>create or replace procedure p1(p_deptno in number)
  is
    cursor c is select * from emp where deptno=p_deptno;
    i emp%rowtype;
  begin
    open c;
    loop
      fetch c into i;
      exit when c%notfound;
      dbms_output.put_line(i.ename);
    end loop;
  exception
    when no_data_found then
      dbms_output.put_line('Give proper deptno');
  end p1;
  /
  </code></pre>
  
  <p>When I run it using SQL*Plus, I get this:</p>
  
  <blockquote>
    <p>SQL> exec p1(70);</p>
    
    <p>PL/SQL procedure successfully completed.</p>
  </blockquote>
  
  <p>But deptno 70 is not available. Exception should be raised, but it is not. What am I doing wrong?</p>