您好,登錄后才能下訂單哦!
http://www.itpub.net/thread-1499223-20-1.html
197樓
我在當(dāng)前會(huì)話把PL/Scope打開:
ALTER SESSION SET plscope_settings='identifiers:all' /
然后我創(chuàng)建了這個(gè)包頭:
CREATE OR REPLACE PACKAGE plch_pkg IS PROCEDURE do_stuff; END plch_pkg; /
下列哪些查詢實(shí)現(xiàn)了一個(gè)包體,從而使得下列的查詢:
SELECT name, usage FROM user_identifiers WHERE object_name = 'PLCH_PKG' AND type IN ('PROCEDURE', 'FUNCTION') ORDER BY usage /
會(huì)輸出這些結(jié)果:
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:在此選項(xiàng)中do_stuff被重載,所以DECLARATION 和 DEFINITION的顯示行數(shù)是正確的。但是,并沒有對(duì)do_stuff的調(diào)用。
B:為了使得DECLARATION 和 DEFINITION各顯示兩行,do_stuff必須被重載。
C:既有重載又有調(diào)用,正確。
D:同上,只是調(diào)用的地方不同。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。