它是否适用于缓存中的全局变量状态

时间:2011-09-09 09:06:41

标签: oracle plsql global-variables packages

关于包中全局变量的图像中的关注信息是否正确,如果没有,请告诉我原因。

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.

1 个答案:

答案 0 :(得分:4)

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