title: How to check parameter value existence in a procedure?
body: <p>The following is a procedure that uses 2 parameters: customer_code and pay_amount. 
  The procedure works as expected, however when I enter wrong cus_code I get the error istead of my custom checking:</p>
  
  <pre><code>ORA-01403: no data found
  ORA-06512: at "XXXXX.CUST_PAY", line 19
  ORA-06512: at line 2
  </code></pre>
  
  <p>The procedure:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE cust_pay (temp_ccode IN NUMBER, pay_amount IN NUMBER)AS
    BEGIN
      DECLARE 
      Value_check NUMBER;
      cbalance NUMBER;
        BEGIN
            SELECT Count(cus_code) 
            INTO value_check
            FROM customer
            WHERE cus_code = temp_ccode;
  
            IF value_check IS NULL THEN
                Dbms_Output.put_line('the value was not FOUND');
            ELSE
                UPDATE customer
                SET cus_balance = cus_balance - pay_amount
                WHERE cus_code = temp_ccode;
  
                SELECT cus_balance 
                INTO cbalance
                FROM customer
                WHERE cus_code = temp_ccode;
  
                  IF cbalance &lt; 0 THEN
                      Dbms_Output.put_line('The client owes us ' || cbalance);
                  ELSE
                      Dbms_Output.put_line('Customer new balance is ' || cbalance);
                  END IF;
          END IF;
       END;
    END;
  </code></pre>
  
  <p>What do I do wrong? I guest I need to check the value before I make SELECT request, right?</p>