我需要在不删除软件包的情况下向此软件包添加功能吗?只需添加另一个功能。
DROP PACKAGE BANINST1.SB_ENROLLMENT
CREATE OR REPLACE PACKAGE BANINST1.sb_enrollment AS
FUNCTION f_query_all_active_ptrm ()
RETURN enrollment_ref;
END sb_enrollment;
DROP PACKAGE BODY BANINST1.SB_ENROLLMENT
/
CREATE OR REPLACE PACKAGE BODY BANINST1.sb_enrollment AS
FUNCTION f_query_all_active_ptrm ()
RETURN enrollment_ref;
BEGIN
END f_query_all_active_ptrm;
END sb_enrollment;
答案 0 :(得分:4)
你不能ALTER
一个包来添加新功能。但是,由于您使用的是CREATE OR REPLACE
,因此无需DROP
包或包体。由于包是单个对象,因此您需要完整地替换包规范和包体(因此您需要包括所有现有的功能和过程)。
CREATE OR REPLACE PACKAGE BANINST1.sb_enrollment
AS
FUNCTION f_query_all_active_ptrm ()
RETURN enrollment_ref;
FUNCTION new_function_name
RETURN number;
END sb_enrollment;
CREATE OR REPLACE PACKAGE BODY BANINST1.sb_enrollment
AS
FUNCTION f_query_all_active_ptrm ()
RETURN enrollment_ref;
BEGIN
<<some implementation>>
END f_query_all_active_ptrm;
FUNCTION new_function_name
RETURN number
IS
BEGIN
RETURN 1;
END;
END sb_enrollment;