PRAGMA_SERIALLY_REUSABLE: Package vars default value ll be reset at every call in a session if u use this pragma in the pkg. else it wont.
Example of Serially Reusable Packages :How Package Variables Act Across Call Boundaries
This example has a serially reusable package specification (there is no body).
CONNECT Scott/Tiger
CREATE OR REPLACE PACKAGE Sr_pkg IS
PRAGMA SERIALLY_REUSABLE;
N NUMBER := 5; -- default initialization
END Sr_pkg;
Suppose your Enterprise Manager (or SQL*Plus) application issues the following:
CONNECT Scott/Tiger
# first CALL to server
BEGIN
Sr_pkg.N := 10;
END;
# second CALL to server
BEGIN
DBMS_OUTPUT.PUT_LINE(Sr_pkg.N);
END;
This program prints:
5
Note: If the package had not had the pragma SERIALLY_REUSABLE, the program would have printed '10'.
Example of Serially Reusable Packages :How Package Variables Act Across Call Boundaries
This example has a serially reusable package specification (there is no body).
CONNECT Scott/Tiger
CREATE OR REPLACE PACKAGE Sr_pkg IS
PRAGMA SERIALLY_REUSABLE;
N NUMBER := 5; -- default initialization
END Sr_pkg;
Suppose your Enterprise Manager (or SQL*Plus) application issues the following:
CONNECT Scott/Tiger
# first CALL to server
BEGIN
Sr_pkg.N := 10;
END;
# second CALL to server
BEGIN
DBMS_OUTPUT.PUT_LINE(Sr_pkg.N);
END;
This program prints:
5
Note: If the package had not had the pragma SERIALLY_REUSABLE, the program would have printed '10'.