Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL application wide state
roger wrote:
> I'm a wonderin...
>
> I have an application that will implement key business logic in PL/SQL,
> and uses various configuration values, as stored in various database
> tables, to control certain aspects of it's operations.
>
> Is there not some way to read these configuration values into some
> sort of persistent application wide memory cache?
>
> Like, if I were writing a C++, java, or C# application, I'd read the
> various configuration tables at startup, (or on first use), and populate
> a single application wide cache that would be used subsequently.
>
>
> Is there no corresponding mechanism with PL/SQL?
<snip>?
See globally accessed application context in the documentation. You can set these up on a user and/or client basis or across all users. They are designed to be secure by specifying a single package or procedure that can modify their state but you can specify sys.dbms_session to essentially make them unsecure. For example ...
create context my_context using sys.dbms_session accessed globally; dbms_session.set_context('MY_CONTEXT', 'MY_ATTRIBUTE', 'MY_VALUE');
then anytime anybody connects you can use the SYS_CONTEXT function to retrieve values ...
value := sys_context('MY_CONTEXT', 'MY_ATTRIBUTE');
As I said, you can also make them user and client specific (see the documentation for more information). Have a look at the GLOBAL_CONTEXT system view as well.
Richard Kuhler Received on Tue Sep 30 2003 - 17:43:08 CDT