【问题标题】:Is It Correct for global variable state in cache缓存中的全局变量状态是否正确
【发布时间】:2011-11-13 15:14:06
【问题描述】:

图片中关于包中全局变量的以下信息是否正确,如果不正确,请告诉我原因。

Examine this code: 
CREATE OR REPLACE PACKAGE comm_package
IS
g_comm NUMBER := 10;
PROCEDURE reset_comm(p_comm IN NUMBER);
END comm_package;
/
User Jones executes the following code at 9:01am:
EXECUTE comm_package.g_comm := 15
User Smith executes the following code at 9:05am:
EXECUTE comm_package.g_comm := 20

Which statement is True?

A.  g_comm has value of 15 at 9:06 for smith.
B.  g_comm has value of 15 at 9:06 for jones.
C.  g_comm has value of 20 at 9:06 for both smith and jones.
D.  g_comm has value of 15 at 9:03 for both smith and jones.
E.  g_comm has value of 10 at 9:06 for both smith and jones.
F.  g_comm has value of 10 at 9:03 for both smith and jones.

ANSWER: B.

【问题讨论】:

  • 图像不能被其他用户索引/搜索,所以它只会“污染”问题数据库。
  • 非常感谢你让我意识到我的错误,我下次会处理它。

标签: oracle plsql global-variables packages


【解决方案1】:

包变量状态的范围是 session 级别。因此,唯一能看到G_COMM=15 的用户将是琼斯。因此 B 是正确的答案。

【讨论】:

  • +1。如果您需要“跨会话”变量,请查看全局应用程序上下文
猜你喜欢
  • 2014-12-08
  • 2012-01-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-06
  • 2020-08-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多