Reference package variable in a procedure : Procedure Definition « Stored Procedure Function « Oracle PL / SQL






Reference package variable in a procedure

    


SQL>
SQL> create or replace procedure MY_PROC(p_input varchar2) is
  2      v1 varchar2(30);
  3  begin
  4      v1 := p_input;
  5  end;
  6  /

Procedure created.

SQL> create or replace package MY_PKG is
  2    glob_var varchar2(40) := 'asdf';
  3  end;
  4  /

Package created.

SQL>
SQL> exec MY_PROC(my_pkg.glob_var);

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> create or replace procedure MY_PROC(p_input varchar2) is
  2      v1 my_pkg.glob_var%type;
  3  begin
  4        null;
  5  end;
  6  /

Procedure created.

SQL> create or replace package MY_PKG is
  2   glob_var varchar2(60) := 'asdf';
  3  end;
  4  /

Package created.

SQL>

   
    
    
    
  








Related examples in the same category

1.Creat an empty procedure
2.replace a procedure
3.Create a stored procedure and how to call it.
4.Define procedure to insert data
5.Define and call procedure
6.Create procedure with authid
7.Create a stored procedure with authid
8.Mutually exclusive local subprograms.
9.A forward declaration.
10.Inner procedure
11.Save calculation result to a table in procedure
12.exception throwed out of the procedure
13.AUTHID clause in a CREATE PROCEDURE statement indicates that this procedure is being created with user's or invoker's rights
14.Increase gift price
15.A local subprogram within a stored procedure
16.Overloaded local procedures: number and varchar2
17.Using all the default values
18.Forward Referencing
19.Mark procedure with authid current_user
20.Only manager can change the password