Initialization of 2011-11-8 packet variables
Http://www.itpub.net/thread-1499223-12-1.html
119 floor
What will appear on my screen after executing the following statements?
CREATE OR REPLACE PACKAGE plch_pkgIS g_public NUMBER: = 1; PROCEDURE do_stuff; FUNCTION get_stuff RETURN NUMBER;END;/CREATE OR REPLACE PACKAGE BODY plch_pkgIS 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: = 2ten 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)
one
(B)
twelve
(C)
one hundred and twenty three
(D)
1234
(E)
12334
(F)
123234
The measured answer is F
SQL > Package createdPackage body created123234PL/SQL procedure successfully completedSQL >
The answer is on the 125th floor
2011-11-8 answer F.
The initial value of the header declaration precedes the packet body. The initialization code is executed the first time the packet is called, thus overwriting the initial value in the header.