Package declaration and body : Package Body « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> set serveroutput on
SQL>
SQL> CREATE OR REPLACE PACKAGE myPackage
  2  IS
  3     PROCEDURE calc_total (zone_in IN VARCHAR2);
  4
  5     PROCEDURE calc_total (reg_in IN VARCHAR2);
  6
  7  END myPackage;
  8  /

Package created.

SQL>
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY myPackage
  2  IS
  3     PROCEDURE calc_total (zone_in IN VARCHAR2)
  4     IS
  5     BEGIN dbms_output.put_line ('zone'); END;
  6
  7     PROCEDURE calc_total (reg_in IN VARCHAR2)
  8     IS
  9     BEGIN dbms_output.put_line ('region'); END;
 10
 11  END myPackage;
 12  /

Package body created.

SQL>
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