/tupian/20230522/thread-1499223-12-1.html
創(chuàng)新互聯(lián)公司是一家專(zhuān)注于成都做網(wǎng)站、成都網(wǎng)站建設(shè)與策劃設(shè)計(jì),舞鋼網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:舞鋼等地區(qū)。舞鋼做網(wǎng)站價(jià)格咨詢(xún):18980820575119樓
執(zhí)行下列語(yǔ)句之后,我的屏幕上會(huì)顯示什么?
CREATE OR REPLACE PACKAGE plch_pkg IS g_public NUMBER := 1; PROCEDURE do_stuff; FUNCTION get_stuff RETURN NUMBER; END; / CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE do_stuff IS BEGIN DBMS_OUTPUT.put_line (g_public); END; FUNCTION get_stuff RETURN NUMBER IS BEGIN do_stuff; RETURN g_public + 1; END; BEGIN DBMS_OUTPUT.put_line (g_public); g_public := 2; END; / BEGIN DBMS_OUTPUT.put_line (plch_pkg.get_stuff); plch_pkg.g_public := plch_pkg.get_stuff; DBMS_OUTPUT.put_line (plch_pkg.get_stuff); END; /
(A)
1
(B)
1 2
(C)
1 2 3
(D)
1 2 3 4
(E)
1 2 3 3 4
(F)
1 2 3 2 3 4
實(shí)測(cè)答案為F
SQL> Package created Package body created 1 2 3 2 3 4 PL/SQL procedure successfully completed SQL>
答案說(shuō)明在125樓
2011-11-8 答案F.
包頭聲明的初始值先于包體。包體第一次被調(diào)用時(shí)會(huì)執(zhí)行初始化代碼,因而將包頭里面的初始值覆蓋了。