存储过程_if else的例子

 

PROCEDURE award_bonus (emp_id   NUMBER) IS   
      bonus REAL;   
      comm_missing EXCEPTION;   
  BEGIN   -- executable part starts here   
      SELECT comm*0.15 INTO bonus FROM emp WHERE empno =   emp_id;   
      IF bonus IS NULL THEN   
          RAISE comm_missing;   
      ELSE   
          UPDATE payroll SET pay = pay+bonus WHERE empno=emp_id;   
      END IF;   
  EXCEPTION   -- exception-handling part starts here   
      WHEN comm_missing THEN   
      ...   
  END award_bonus;  

 

 

你可能感兴趣的:(if else)