title: How can I modify my PL/SQL procedure to go to my exception handling?
body: <p>I am using SQL developer to write a procedure. </p>
  
  <p>The objective is to get the name of the drainage system from one table and get the count of how much the drainage system name code appears in another table. </p>
  
  <p>My procedure works, but when I enter an incorrect value, it does not go to the exception section. For example, when I input ‘Mexico River’, this name does not exist in the table. So, I want my exception section to realize that this is an incorrect value being entered. </p>
  
  <p>My question is how do I modify my code, so it can detect incorrect values and go to my exception section. </p>
  
  <p>Below is a snippet of my code:</p>
  
  <pre><code>PROCEDURE number_of_rivers --second procedure with 1 parameter
    (input_sysName IN TBLDrainage.DRAINAGE_SYS%TYPE)
     is 
  
      -- Create a cursor 
      cursor c_river is 
        select code, drainage_sys 
        from TBLDRAINAGE 
        where DRAINAGE_SYS = input_sysName;
      v_rivercount Number;
      r_variable c_river %rowtype; 
  
    Begin
  
     FOR r_variable in c_river
     loop 
       select count (Drainage_sys) into v_rivercount
       from TBLRIVER
       where DRAINAGE_SYS = r_variable.code;
       DBMS_OUTPUT.PUT_LINE (UPPER(input_sysName) || ' has ' || v_rivercount || ' river(s) in the drainage system.');
    end loop;
  
  
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      DBMS_OUTPUT.PUT_LINE ('Error: Please enter a valid drainage system name');
    WHEN OTHERS THEN
      DBMS_OUTPUT.PUT_LINE ('Error in finding system');
  END ;
  </code></pre>