您好,登錄后才能下訂單哦!
本篇內容主要講解“怎么理解數據庫包和包體的刪除語法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“怎么理解數據庫包和包體的刪除語法”吧!
我創建了這個小工具程序來顯示一個指定對象的狀態:
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
到此,相信大家對“怎么理解數據庫包和包體的刪除語法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。