本篇内容主要讲解“怎么理解数据库包和包体的删除语法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么理解数据库包和包体的删除语法”吧!
站在用户的角度思考问题,与客户深入沟通,找到通许网站设计与通许网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、成都网站制作、外贸网站建设、企业官网、英文网站、手机端网站、网站推广、申请域名、网页空间、企业邮箱。业务覆盖通许地区。
我创建了这个小工具程序来显示一个指定对象的状态:
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
到此,相信大家对“怎么理解数据库包和包体的删除语法”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!