Press "Enter" to skip to content

How to Execute a Procedure Inside a Package in Oracle

Executing a procedure inside a package in Oracle is just by giving package reference before the procedure. For example, your procedure name is Extract_Emp_Data in the package EMP_INTERFACE then execute it as follows:

Execute a Procedure Inside a Package in Oracle Example

Begin
/* Package_Name.Procedure_Name */
EMP_Interface.Extract_Emp_Data;
End;
/

if Your procedure is having parameters then execute as follow:

For the below example assuming that there is an IN parameter for employee name and OUT parameter for error if any.

SET SERVEROUTPUT ON;
Declare
v_o_error varchar2(1000);
Begin
EMP_Interface.Extract_Emp_Data ('John', v_o_error);
DBMS_OUTPUT.PUT_LINE(v_o_error);
End;
/

If you are executing a packaged procedure from within the same package but in another procedure, then you can omit the package name. Below is the example:

SET SERVEROUTPUT ON;
Declare
v_o_error varchar2(1000);
Begin
Extract_Emp_Data ('John', v_o_error);
DBMS_OUTPUT.PUT_LINE(v_o_error);
End;
/