How many public procedures are in the MANAGE_EMPS package?

Examine this package:
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 manage_emps;
/
CREATE OR REPLACE PACKAGE BODY manage_emps
IS
PROCEDURE update_sal
(p_raise_amt NUMBER)
IS
BEGIN
UPDATE emp
SET sal = (sal * p_raise_emt) + sal
WHERE empno = v_id;
END;
PROCEDURE insert_emp
(p_deptno NUMBER, p_sal NUMBER)
IS
BEGIN
INSERT INTO emp(empno, deptno, sal)
VALYES(v_id, p_depntno, p_sal);
END insert_emp;
PROCEDURE delete_emp
IS
BEGIN
DELETE FROM emp
WHERE empno = v_id;
END delete_emp;
PROCEDURE update_emp
IS
v_sal NUMBER(10, 2);
v_raise NUMBER(10, 2);
BEGIN
SELECT sal
INTO v_sal
FROM emp
WHERE empno = v_id;
IF v_sal < 500 THEN
v_raise := .05;
ELSIP v_sal < 1000 THEN
v_raise := .07;
ELSE
v_raise := .04;
END IF;
update_sal(v_raise);
END update_emp;
FUNCTION calc_tax
(p_sal NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_sal * tax_rate;
END calc_tax;
END manage_emps;
/
How many public procedures are in the MANAGE_EMPS package?

Examine this package:
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 manage_emps;
/
CREATE OR REPLACE PACKAGE BODY manage_emps
IS
PROCEDURE update_sal
(p_raise_amt NUMBER)
IS
BEGIN
UPDATE emp
SET sal = (sal * p_raise_emt) + sal
WHERE empno = v_id;
END;
PROCEDURE insert_emp
(p_deptno NUMBER, p_sal NUMBER)
IS
BEGIN
INSERT INTO emp(empno, deptno, sal)
VALYES(v_id, p_depntno, p_sal);
END insert_emp;
PROCEDURE delete_emp
IS
BEGIN
DELETE FROM emp
WHERE empno = v_id;
END delete_emp;
PROCEDURE update_emp
IS
v_sal NUMBER(10, 2);
v_raise NUMBER(10, 2);
BEGIN
SELECT sal
INTO v_sal
FROM emp
WHERE empno = v_id;
IF v_sal < 500 THEN
v_raise := .05;
ELSIP v_sal < 1000 THEN
v_raise := .07;
ELSE
v_raise := .04;
END IF;
update_sal(v_raise);
END update_emp;
FUNCTION calc_tax
(p_sal NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_sal * tax_rate;
END calc_tax;
END manage_emps;
/
How many public procedures are in the MANAGE_EMPS package?

A.
One

B.
Two

C.
Three

D.
Four

E.
Five

Explanation:
There are three procedure that are declared in the Package Specification and these Procedures are public and can be called from inside and outside of the package.
Incorrect Answers
A, B, D & E: There are three procedures and one function declared in the package specification which are public. There is also one procedure that is only declared in the package body and it is private.



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Edmilson

Edmilson

I think B, becuse there are two procedures and one function.

Tomas

Tomas

I thought so to, but there are two procedures on the same line of the specification:

PROCEDURE insert_emp (p_deptno NUMBER, p_sal NUMBER); PROCEDURE delete_emp;
PROCEDURE update_emp;