CREATE OR REPLACE PACKAGE BODY comm_pkg IS


  FUNCTION validate(comm NUMBER) RETURN BOOLEAN 

  IS

    max_comm employees.commission_pct%type;

  BEGIN

    SELECT MAX(commission_pct) INTO max_comm

    FROM   employees;

    RETURN (comm BETWEEN 0.0 AND max_comm);

  END validate;


  PROCEDURE reset_comm (new_comm NUMBER)

  IS

  BEGIN

    IF validate(new_comm) THEN

      std_comm := new_comm; -- reset public var

    ELSE

      RAISE_APPLICATION_ERROR(-20210, 'Bad Commission');

    END IF;

  END reset_comm;


END comm_pkg;

/

+ Recent posts