路虽弥,不行不至;事虽少,不做不成。
分类: Oracle
2010-09-08 11:02:12
Step1>To create package and package body;
Create or replace package my_context_test as
Procedure set_value(value varchar2);
End;
Create or replace package body my_context_test as
Procedure set_value(value varchar2) as
Begin
DBMS_SESSION.SET_CONTEXT(‘test_context’,’user’,value);
End;
End;
Step2>To create context for package;
CREATE OR REPLACE CONTEXT test_context USING apps.my_context_test ACCESSED GLOBALLY
Step3>To setup context value
Declare
l_value varchar2(10);
begin
Select SYS_CONTEXT('USERENV', 'SESSION_USER') INTO l_value from dual;
my_context_test.set_value(l_value);
end;
Step4>To retire context value
Select sys_context(‘test_context’,’user’) from dual;
----------------------------------------------------------
APPS
Note:
1>You can retire dba_context for your custom context name;
2>You can retire dba_source to look at the source code of your custom package;
3>You can delete your context or package via the following grammar;
DROP CONTEXT test_contest;
DROP PACKAGE my_context_p;
chinaunix网友2011-01-05 17:36:15
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com