文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Demo for Oracle Context{set_context,sys_context}

Demo for Oracle Context{set_context,sys_context}

时间:2010-09-08  来源:richardliu1123

 

 

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;

 

 

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载