十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本篇内容主要讲解“怎么理解数据库包和包体的删除语法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么理解数据库包和包体的删除语法”吧!
创新互联公司云计算的互联网服务提供商,拥有超过13年的服务器租用、遂宁托管服务器、云服务器、网页空间、网站系统开发经验,已先后获得国家工业和信息化部颁发的互联网数据中心业务许可证。专业提供云主机、网页空间、域名注册、VPS主机、云服务器、香港云服务器、免备案服务器等。我创建了这个小工具程序来显示一个指定对象的状态:
CREATE OR REPLACE PROCEDURE plch_show_status ( object_name_in IN VARCHAR2 , type_in IN VARCHAR2) IS l_status user_objects.status%TYPE; BEGIN SELECT ob.status INTO l_status FROM user_objects ob WHERE object_name = object_name_in AND object_type = type_in; DBMS_OUTPUT.put_line ( type_in || ' ' || object_name_in || ': ' || l_status); EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line ( type_in || ' ' || object_name_in || ': UNDEFINED'); END; /
我又创建了这个包:
CREATE OR REPLACE PACKAGE plch_pkg IS PROCEDURE do_stuff; END; / CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff IS BEGIN NULL; END; END; /
我执行了下列选项中的语句之后再执行这个块:
BEGIN plch_show_status ('PLCH_PKG', 'PACKAGE'); plch_show_status ('PLCH_PKG', 'PACKAGE BODY'); END; /
哪些选项会产生这两行输出?
PACKAGE PLCH_PKG: UNDEFINED PACKAGE BODY PLCH_PKG: UNDEFINED
(A)
DROP PACKAGE SPECIFICATION plch_pkg / DROP PACKAGE BODY plch_pkg /
SQL> DROP PACKAGE SPECIFICATION plch_pkg 2 / DROP PACKAGE SPECIFICATION plch_pkg ORA-00933: SQL 命令未正确结束 SQL> DROP PACKAGE BODY plch_pkg 2 / Package body dropped SQL> SQL> BEGIN 2 plch_show_status ('PLCH_PKG', 'PACKAGE'); 3 plch_show_status ('PLCH_PKG', 'PACKAGE BODY'); 4 END; 5 / PACKAGE PLCH_PKG: VALID PACKAGE BODY PLCH_PKG: UNDEFINED PL/SQL procedure successfully completed SQL>
(B)
DROP PACKAGE plch_pkg / DROP PACKAGE BODY plch_pkg /
SQL> DROP PACKAGE plch_pkg 2 / Package dropped SQL> DROP PACKAGE BODY plch_pkg 2 / DROP PACKAGE BODY plch_pkg ORA-04043: 对象 PLCH_PKG 不存在 SQL> SQL> SQL> BEGIN 2 plch_show_status ('PLCH_PKG', 'PACKAGE'); 3 plch_show_status ('PLCH_PKG', 'PACKAGE BODY'); 4 END; 5 / PACKAGE PLCH_PKG: UNDEFINED PACKAGE BODY PLCH_PKG: UNDEFINED PL/SQL procedure successfully completed SQL>
(C)
DROP PACKAGE SPECIFICATION AND BODY plch_pkg /
SQL> DROP PACKAGE SPECIFICATION AND BODY plch_pkg 2 / DROP PACKAGE SPECIFICATION AND BODY plch_pkg ORA-00933: SQL 命令未正确结束 SQL> SQL> SQL> BEGIN 2 plch_show_status ('PLCH_PKG', 'PACKAGE'); 3 plch_show_status ('PLCH_PKG', 'PACKAGE BODY'); 4 END; 5 / PACKAGE PLCH_PKG: VALID PACKAGE BODY PLCH_PKG: VALID PL/SQL procedure successfully completed SQL>
(D)
DROP PACKAGE plch_pkg /
SQL> DROP PACKAGE plch_pkg 2 / Package dropped SQL> SQL> SQL> BEGIN 2 plch_show_status ('PLCH_PKG', 'PACKAGE'); 3 plch_show_status ('PLCH_PKG', 'PACKAGE BODY'); 4 END; 5 / PACKAGE PLCH_PKG: UNDEFINED PACKAGE BODY PLCH_PKG: UNDEFINED PL/SQL procedure successfully completed SQL>
答案BD
到此,相信大家对“怎么理解数据库包和包体的删除语法”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!