包裹:
create or replace package manage_emps
is
tax_rate constant number(5,2) := .28;
v_id number;
procedure insert_emp(p_deptno number,p_sal number);
procedure delete_emp;
procedure update_emp;
function calc_tax(p_sal number) return number;
end;
包体:
create or replace package body manage_emps
is
procedure update_sal(p_raise_amt number)
is
begin
update emp
set sal = (sal * p_raise_amt) + sal;
where empno = v_id;
end;
procedure insert_emp(p_deptno number,p_sal number)
is
begin
insert into emp(empno,deptno,sal)
values(v_id,p_deptno,p_sal);
end;
procedure delete_emp
is
begin
delete from emp
where empno = v_id;
end;
procedure update_emp
is
begin
v_sal number(10,2);
v_raise number(10,2);
select sal into v_sal
from emp
where empno = v_id;
if v_sal < 500 then
v_raise := .05;
elsif v_sal < 1000 then
v_raise := .07;
else
v_raise := .04;
end if;
update_sal(v_raise);
end;
function calc_tax(p_sal number) return number
is
begin
return p_sal * tax_rate;
end;
end;
问题是“MANAGE_EMPS 包中有多少公共程序?” 我回答“三”。怎么会错?显然,包规范中提到了 3 个功能。该过程的声明/主体在包的主体中,然后是私有的。在正文中,过程 UPDATE_SAL 是私有的。但正确答案是:“无”。没有公共程序?如何 ?