Oracle 包中定义了一个全局变量,两个过程,如下:
CREATE OR REPLACE PACKAGE PKG_TEMP IS
V_COUNT NUMBER;
PROCEDURE PRO_TEMP;
PROCEDURE PRO_TEMP_II;
END PKG_TEMP;
两个过程中都用到了V_COUNT变量,如果两个过程并发时,V_COUNT变量值会不会互串啊?
------解决方案--------------------
可以啊,
如下:
create or replace package test is
a number;
procedure a1;
procedure a2;
end test;
create or replace package body test is
procedure a1 is
begin
a := 1;
dbms_output.put_line(a);
a2;
dbms_output.put_line(a);
end;
procedure a2 is
begin
a := 2;
dbms_output.put_line(a);
a1;
dbms_output.put_line(a);
end;
begin
null;
end test;
你可以通过测试a1或者a2来看效果