René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Package variables [Oracle PL/SQL]

create or replace package pack_var
is
  var pls_integer;

end pack_var;
/
The package variable var is initialized in the package initializer:
create or replace package body pack_var is
begin
  var := 42;
end pack_var;
/
exec dbms_output.put_line('1: ' || pack_var.var);
1: 42
exec pack_var.var := 44;
exec dbms_output.put_line('2: ' || pack_var.var);
2: 44
exec pack_var.var := 5;
exec dbms_output.put_line('3: ' || pack_var.var);
3: 5
commit;
exec dbms_output.put_line('4: ' || pack_var.var);
4: 5