您好,登錄后才能下訂單哦!
http://www.itpub.net/thread-1499223-20-1.html
197樓
我在當前會話把PL/Scope打開:
ALTER SESSION SET plscope_settings='identifiers:all' /
然后我創建了這個包頭:
CREATE OR REPLACE PACKAGE plch_pkg IS PROCEDURE do_stuff; END plch_pkg; /
下列哪些查詢實現了一個包體,從而使得下列的查詢:
SELECT name, usage FROM user_identifiers WHERE object_name = 'PLCH_PKG' AND type IN ('PROCEDURE', 'FUNCTION') ORDER BY usage /
會輸出這些結果:
NAME USAGE ---------- ----------- DO_STUFF CALL DO_STUFF DECLARATION DO_STUFF DECLARATION DO_STUFF DEFINITION DO_STUFF DEFINITION
(A)
CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff (number_in IN NUMBER) IS BEGIN NULL; END do_stuff; PROCEDURE do_stuff IS BEGIN NULL; END do_stuff; END plch_pkg; /
SQL> SELECT name, usage 2 FROM user_identifiers 3 WHERE object_name = 'PLCH_PKG' 4 AND type IN ('PROCEDURE', 'FUNCTION') 5 ORDER BY usage 6 / NAME USAGE -------------------------------------------------------------------------------- ----------- DO_STUFF DECLARATION DO_STUFF DECLARATION DO_STUFF DEFINITION DO_STUFF DEFINITION SQL>
(B)
CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff IS BEGIN NULL; END do_stuff; END plch_pkg; /
SQL> SQL> SELECT name, usage 2 FROM user_identifiers 3 WHERE object_name = 'PLCH_PKG' 4 AND type IN ('PROCEDURE', 'FUNCTION') 5 ORDER BY usage 6 / NAME USAGE -------------------------------------------------------------------------------- ----------- DO_STUFF DECLARATION DO_STUFF DEFINITION SQL>
(C)
CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff (number_in IN NUMBER) IS BEGIN NULL; END do_stuff; PROCEDURE do_stuff IS BEGIN do_stuff (1); END do_stuff; END plch_pkg; /
SQL> SELECT name, usage 2 FROM user_identifiers 3 WHERE object_name = 'PLCH_PKG' 4 AND type IN ('PROCEDURE', 'FUNCTION') 5 ORDER BY usage 6 / NAME USAGE -------------------------------------------------------------------------------- ----------- DO_STUFF CALL DO_STUFF DECLARATION DO_STUFF DECLARATION DO_STUFF DEFINITION DO_STUFF DEFINITION SQL>
(D)
CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff (number_in IN NUMBER) IS BEGIN NULL; END do_stuff; PROCEDURE do_stuff IS BEGIN NULL; END do_stuff; BEGIN do_stuff (1); END plch_pkg; /
SQL> SELECT name, usage 2 FROM user_identifiers 3 WHERE object_name = 'PLCH_PKG' 4 AND type IN ('PROCEDURE', 'FUNCTION') 5 ORDER BY usage 6 / NAME USAGE -------------------------------------------------------------------------------- ----------- DO_STUFF CALL DO_STUFF DECLARATION DO_STUFF DECLARATION DO_STUFF DEFINITION DO_STUFF DEFINITION SQL>
答案說明在202樓
2011-11-29 答案CD
A:在此選項中do_stuff被重載,所以DECLARATION 和 DEFINITION的顯示行數是正確的。但是,并沒有對do_stuff的調用。
B:為了使得DECLARATION 和 DEFINITION各顯示兩行,do_stuff必須被重載。
C:既有重載又有調用,正確。
D:同上,只是調用的地方不同。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。