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;
/
'Oracle > PL/SQL' 카테고리의 다른 글
15일차 # 3-14: USER_SOURCE data dictionary (0) | 2012.04.24 |
---|---|
15일차 # 3-11 (0) | 2012.04.24 |
15일차 Chapter 3 - Packages I # 3-8: PACKAGE SPECIFICATION (0) | 2012.04.24 |
15일차 # 2-15: USER_SOURCE data dictionary view (0) | 2012.04.24 |
15일차 # 2-12 (0) | 2012.04.24 |