Examine this code:
CREATE OR REPLACE PACKAGE metric_converter
IS
c_height CONSTRAINT NUMBER := 2.54;
c_weight CONSTRAINT NUMBER := .454;
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY metric_converter
IS
FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * c_height;
END calc_height;
FUNCTION calc_weight (p_weight_in_pounds NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_weight_in_pounds * c_weight
END calc_weight
END metric_converter;
/
CREATE OR REPLACE FUNCTION calc_height (p_height_in_inches NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN p_height_in_inches * metric_converter.c_height;
END calc_height;
/
Which statement is true?
A.
If you remove the package specification, then the package body and the stand alone stored
function CALC_HEIGHT are removed.
B.
If you remove the package body, then the package specification and the stand alone stored
function CALC_HEIGHT are removed.
C.
If you remove the package specification, then the package body is removed.
D.
If you remove the package body, then the package specification is removed.
E.
If you remove the stand alone stored function CALC_HEIGHT, then the
METRIC_CONVERTER package body and the package specification are removed.
F.
The stand alone function CALC_HEIGHT cannot be created because its name is used in a
packaged function.
Explanation:
If you remove the package specification, the package body will be removed.
To remove the package specification and the package body from the database, you use the
following syntax:
DROP PACKAGE <package_name>;
The DROP PACKAGE statement removes both the package specification and the package body
from the database.
Incorrect Answers:
A: If you remove the package specification the package body will also be deleted. To delete a
stand-alone procedure you must issue a DROP PROCEDURE ProcedureName command.
B: If you remove the package body only the package body is removed by the DROP PACKAGE
BODY command. To delete the package specification and the package body you issue a DROP
PACAKGE Command. Droppig a Package has no impact on stand-alone procedures.
D: The DROP PACKAGE BODY statement removes only the package body. The package
specificationremains intact in the database. The status of the package specification remains
VALID even if thecorresponding package body is dropped from the database.To remove only the
package body from the database, you use the following syntax:DROP PACKAGE BODY
<package_name>;
E: Dropping a stand-alone procedure or function does not drop any package objects.
F: You may have stand-alone functions & procedures with the same name as a Packaged
program units. They are stored separately and they are qualified using the Package Name when
calling the Package Procedure or function.