Excellent explanation
Sai Pradyumn, December 11, 2016 - 5:29 pm UTC
Hi McDonald. Thank you very much for valuable explanation.Its really very help for me. Is this kind of behaviour is applicable only for global variable in the package apec. What about the public variables which are declared in package body directly (not part of any procedure) I am calling these packages through the Shell script which invokes a java appllication. From this java application we are calling tha data base procedure. If I am calling same packages with different parameters sequentially ,second execution will create a new session ? Or it will continue with existing session only
December 12, 2016 - 1:11 am UTC
Package *body* global variables work in the same way, except that the only thing that can reference them is code within the same package body.
Assuming your java application makes a single connection to the database, then you would be ok. But many applications like this make use of a connection pool facility, ie, several sessions share the load. If this is the case, then multiple calls might use different sessions and hence you would not be able to rely on the value of the variable across calls.
Hope this helps.