Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1803021
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: 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;

 

 

 

阅读(2270) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-01-05 17:36:15

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com