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;
/
Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.