Use package member variable to pass value : Package Body « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL> create table t as select * from all_objects;

Table created.

SQL>
SQL> create or replace package myPackage
  2  as
  3      type varchar2_array is table of varchar2(30) index by binary_integer;
  4      type rc is ref cursor;
  5      procedure index_by( p_owner in varchar2, p_object_name out varchar2_array,p_object_type out varchar2_array,p_timestamp out varchar2_array );
  6      procedure ref_cursor( p_owner in varchar2, p_cursor in out rc );
  7  end;
  8  /

Package created.

SQL>
SQL> create or replace package body myPackage
  2  as
  3  procedure index_by( p_owner in varchar2,p_object_name out varchar2_array,p_object_type out varchar2_array,p_timestamp out varchar2_array )
  4  is
  5  begin
  6      select object_name, object_type, timestamp
  7        bulk collect into p_object_name, p_object_type, p_timestamp
  8        from t
  9       where owner = p_owner;
 10  end;
 11
 12  procedure ref_cursor( p_owner in varchar2,p_cursor in out rc )
 13  is
 14  begin
 15      open p_cursor for select object_name, object_type, timestamp from t where owner = p_owner;
 16      end;
 17  end;
 18  /

Package body created.

SQL>
SQL>
SQL> drop table t;

Table dropped.

SQL>
SQL>
SQL>








27.11.Package Body
27.11.1.Package with only one function
27.11.2.Package with two procedures
27.11.3.Package declaration and body
27.11.4.Use of 'get' and 'set' prefixes
27.11.5.Use package method in a procedure
27.11.6.Call function in a Package
27.11.7.Method overload
27.11.8.Package method overloading
27.11.9.Reference method from another package
27.11.10.Package Function with 'PRAGMA AUTONOMOUS_TRANSACTION'
27.11.11.Create a package containing stored procedure DELETE_ORDERS and stored function GET_employee_NAME.
27.11.12.Package initialization.
27.11.13.Use package member variable to pass value