Global Warning
You’ve just got to be mindful about how you handle global package variables.
Here is a little obstacle I recently stumbled over:
I have a package with a global boolean variable g_flag. I set this variable to TRUE in my package specification.
In one of the packaged procedures I set g_flag to FALSE. Now when I run this package in a new session, g_flag gets set to TRUE in the package specification and my code executes just fine. Even when this flag is set to FALSE along the way, whenever the package is executed in a new session, the flag gets reset to TRUE again. Great!
But I forgot that the values of global package variables persist during sessions. This bit me in my rear, when I executed the package as part of along running loop. In my case this loop executed the package every 24 hours.
Of course, somewhere along the way, g_flag was set to FALSE. The next day the package executed again, it started with g_flag being FALSE and not TRUE, as my code originally expected it; then things fell apart.
So: It is prudent, unless otherwise required by your application, to explicitly set your global package variables before you use them.