tags:

views:

206

answers:

1

Given the following Oracle (10g) package definition:

create or replace PACKAGE "foo"
AS

   bar VARCHAR2(32000) := NULL;

END;

what is the scope of bar? Does each session get its own foo.bar, or is foo.bar global across sessions?

Can you quote me chapter and verse from a reference document?

+5  A: 

The scope is at the session level. See the first sentence under the heading "Added Functionality" in the PL/SQL User's Guide and Reference

DCookie
You can change this behaviour by setting: PRAGMA SERIALLY_REUSABLE;
Robert Merkwürdigeliebe
You're not trying to say the globals are available across sessions, are you? Here is a description from the Oracle Application Developers Guide of PRAGMA_SERIALLY_REUSABLE: http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10795/adfns_pc.htm#1008314
DCookie
Sorry, as usual, was not clear. It changes the scope of the package var from session to unit of work. Essentially disabling the reussability of the variable
Robert Merkwürdigeliebe