Oracle 包级变量的范围

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2383061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 02:27:14  来源:igfitidea点击:

Scope of Oracle package level variables

oracleplsql

提问by tpdi

Given the following Oracle (10g) package definition:

鉴于以下 Oracle (10g) 包定义:

create or replace PACKAGE "foo"
AS

   bar VARCHAR2(32000) := NULL;

END;

what is the scope of bar? Does each session get its own foo.bar, or is foo.bar global across sessions?

酒吧的范围是什么?每个会话都有自己的 foo.bar,还是会话间的 foo.bar 是全局的?

Can you quote me chapter and verse from a reference document?

你能从参考文件中引用我的章节吗?

采纳答案by DCookie

The scope is at the session level. See the first sentence under the heading "Added Functionality" in the PL/SQL User's Guide and Reference

范围在会话级别。请参阅PL/SQL 用户指南和参考中“添加的功能”标题下的第一句话

回答by Jeby Sebastian

This variable can contain different values across multiple sessions. If you want to change this, please use PRAGMA_SERIALLY_REUSABLE.

此变量可以包含跨多个会话的不同值。如果你想改变这个,请使用 PRAGMA_SERIALLY_REUSABLE。