What is the name of the private procedure in this 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;
/
What is the name of the private procedure in this 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;
/
What is the name of the private procedure in this package?

A.
CALC_TAX

B.
INSERT_EMP

C.
UPDATE_SAL

D.
DELETE_EMP

E.
UPDATE_EMP

F.
MANAGE_EMPS

Explanation:
This procedure is not declared in the package specification and therefore it is not public. Constructs declared and defined in the package body are known as private constructs. These constructs are available from inside the package only and cannot be called from outside the package.
Incorrect Answers
A, B, D & E Procedures declared in the package specification are public constructs and they can be
referenced from outside the package.
F: Is the Package Name and it is not a Public or Private Procedure



Leave a Reply 0

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