Oracle 23.26PL/SQLLab-verified · 2026-11-29

ORA-06508: PL/SQL: could not find program unit being called

The package being called has no body, or its body is invalid and could not be compiled.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-06508: PL/SQL: could not find program unit being called: "LAB_A.PKG_ORDER"

Jump to a cause

  1. 01The package spec was created but the body was not
  2. 02A function the package body calls was dropped
  3. 03A column used in the body was renamed

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim

ORA-06508 means PL/SQL tried to run a program unit (here, a package) and could not use it. In every test it came with another error directly above it that tells you why: ORA-04067 when the package body does not exist, and ORA-04063 when the body exists but has compile errors. Read that line first.

In the tests ORA-06508 appeared when the package was called from PL/SQL (EXEC or a procedure). The three causes below are the ones that come up most often after a deployment.

01The package spec was created but the body was not

Only the spec of PKG_ORDER was created, and the procedure BATCH_CLOSE calls pkg_order.close_order. EXEC batch_close failed with ORA-04067 (package body "LAB_A.PKG_ORDER" does not exist), then ORA-06508 for the same package, then ORA-06512 pointing at line 3 of BATCH_CLOSE.

USER_OBJECTS showed only a PACKAGE row for PKG_ORDER and no PACKAGE BODY row. After creating the package body, EXEC batch_close printed closed 1.

Setup
Setuprun as lab_a
CREATE OR REPLACE PACKAGE pkg_order AS
  PROCEDURE close_order(p_id NUMBER);
END;
/
CREATE OR REPLACE PROCEDURE batch_close AS
BEGIN
  pkg_order.close_order(1);
END;
/
OUTPUT
Package created.


Procedure created.
Reproducerun as lab_a
EXEC batch_close
✕ ERROR
BEGIN batch_close; END;

*
ERROR at line 1:
ORA-04067: not executed, package body "LAB_A.PKG_ORDER" does not exist
ORA-06508: PL/SQL: could not find program unit being called: "LAB_A.PKG_ORDER"
ORA-06512: at "LAB_A.BATCH_CLOSE", line 3
ORA-06512: at line 1
Help: https://docs.oracle.com/error-help/db/ora-04067/
Checkrun as lab_a
SELECT object_name, object_type, status FROM user_objects WHERE object_name = 'PKG_ORDER' ORDER BY object_type;
OUTPUT
OBJECT_NAME                    OBJECT_TYPE                    STATUS
------------------------------ ------------------------------ ------------------------------
PKG_ORDER                      PACKAGE                        VALID

1 row selected.
Fixrun as lab_a
CREATE OR REPLACE PACKAGE BODY pkg_order AS
  PROCEDURE close_order(p_id NUMBER) IS
  BEGIN
    DBMS_OUTPUT.PUT_LINE('closed ' || p_id);
  END;
END;
/
OUTPUT
Package body created.

Compiling a spec alone succeeds, and so does the procedure that calls it. The error only shows up at run time, so check that both PACKAGE and PACKAGE BODY exist after a deployment.

After the fixrun as lab_a
SET SERVEROUTPUT ON
EXEC batch_close
✓ SUCCESS
closed 1

PL/SQL procedure successfully completed.

02A function the package body calls was dropped

The body of PKG_CALC calls the standalone function GET_TAX_RATE. After DROP FUNCTION get_tax_rate, calling pkg_calc.tax(1000) failed with ORA-04063 (package body "LAB_A.PKG_CALC" has errors) and ORA-06508.

USER_ERRORS for PKG_CALC showed line 4: identifier 'GET_TAX_RATE' must be declared. After recreating the function and running ALTER PACKAGE pkg_calc COMPILE BODY, the call returned 100.

Setup
Setuprun as lab_a
CREATE OR REPLACE FUNCTION get_tax_rate RETURN NUMBER IS
BEGIN
  RETURN 0.1;
END;
/
CREATE OR REPLACE PACKAGE pkg_calc AS
  FUNCTION tax(p_amt NUMBER) RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY pkg_calc AS
  FUNCTION tax(p_amt NUMBER) RETURN NUMBER IS
  BEGIN
    RETURN p_amt * get_tax_rate;
  END;
END;
/
DROP FUNCTION get_tax_rate;
OUTPUT
Function created.


Package created.


Package body created.


Function dropped.
Reproducerun as lab_a
SET SERVEROUTPUT ON
EXEC DBMS_OUTPUT.PUT_LINE(pkg_calc.tax(1000))
✕ ERROR
BEGIN DBMS_OUTPUT.PUT_LINE(pkg_calc.tax(1000)); END;

*
ERROR at line 1:
ORA-04063: package body "LAB_A.PKG_CALC" has errors
ORA-06508: PL/SQL: could not find program unit being called: "LAB_A.PKG_CALC"
ORA-06512: at line 1
Help: https://docs.oracle.com/error-help/db/ora-04063/
Checkrun as lab_a
COLUMN message FORMAT A60
SELECT line, position, message_number, REGEXP_REPLACE(text, '^([A-Z/]+: )?[A-Z]+-[0-9]+: ', '') AS message
FROM user_errors WHERE name = 'PKG_CALC' AND attribute = 'ERROR' ORDER BY sequence;
OUTPUT
      LINE   POSITION MESSAGE_NUMBER MESSAGE
---------- ---------- -------------- ------------------------------------------------------------
         4         20            201 identifier 'GET_TAX_RATE' must be declared
         4          5              0 PL/SQL: Statement ignored

2 rows selected.
Fixrun as lab_a
CREATE OR REPLACE FUNCTION get_tax_rate RETURN NUMBER IS
BEGIN
  RETURN 0.1;
END;
/
ALTER PACKAGE pkg_calc COMPILE BODY;
OUTPUT
Function created.


Package body altered.
After the fixrun as lab_a
SET SERVEROUTPUT ON
EXEC DBMS_OUTPUT.PUT_LINE(pkg_calc.tax(1000))
✓ SUCCESS
100

PL/SQL procedure successfully completed.

03A column used in the body was renamed

The body of PKG_ITEM selects unit_price from ITEMS. After ALTER TABLE items RENAME COLUMN unit_price TO list_price, calling pkg_item.price(1) failed with ORA-04063 and ORA-06508.

USER_OBJECTS showed PACKAGE VALID and PACKAGE BODY INVALID, and USER_ERRORS showed "UNIT_PRICE": invalid identifier on line 5. Recompiling alone would fail again, so the body was rewritten to select list_price. The call then returned 100.

Setup
Setuprun as lab_a
CREATE TABLE items (item_id NUMBER PRIMARY KEY, item_name VARCHAR2(30), unit_price NUMBER);
INSERT INTO items VALUES (1, 'bolt', 100);
COMMIT;
CREATE OR REPLACE PACKAGE pkg_item AS
  FUNCTION price(p_id NUMBER) RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY pkg_item AS
  FUNCTION price(p_id NUMBER) RETURN NUMBER IS
    v NUMBER;
  BEGIN
    SELECT unit_price INTO v FROM items WHERE item_id = p_id;
    RETURN v;
  END;
END;
/
ALTER TABLE items RENAME COLUMN unit_price TO list_price;
OUTPUT
Table created.


1 row created.


Commit complete.


Package created.


Package body created.


Table altered.
Reproducerun as lab_a
SET SERVEROUTPUT ON
EXEC DBMS_OUTPUT.PUT_LINE(pkg_item.price(1))
✕ ERROR
BEGIN DBMS_OUTPUT.PUT_LINE(pkg_item.price(1)); END;

*
ERROR at line 1:
ORA-04063: package body "LAB_A.PKG_ITEM" has errors
ORA-06508: PL/SQL: could not find program unit being called: "LAB_A.PKG_ITEM"
ORA-06512: at line 1
Help: https://docs.oracle.com/error-help/db/ora-04063/
Checkrun as lab_a
COLUMN message FORMAT A60
SELECT object_type, status FROM user_objects WHERE object_name = 'PKG_ITEM' ORDER BY object_type;
SELECT line, position, message_number, REGEXP_REPLACE(text, '^([A-Z/]+: )?[A-Z]+-[0-9]+: ', '') AS message
FROM user_errors WHERE name = 'PKG_ITEM' AND attribute = 'ERROR' ORDER BY sequence;
OUTPUT
OBJECT_TYPE                    STATUS
------------------------------ ------------------------------
PACKAGE                        VALID
PACKAGE BODY                   INVALID

2 rows selected.


      LINE   POSITION MESSAGE_NUMBER MESSAGE
---------- ---------- -------------- ------------------------------------------------------------
         5         12              0 "UNIT_PRICE": invalid identifier
         5          5              0 PL/SQL: SQL Statement ignored

2 rows selected.
Fixrun as lab_a
CREATE OR REPLACE PACKAGE BODY pkg_item AS
  FUNCTION price(p_id NUMBER) RETURN NUMBER IS
    v NUMBER;
  BEGIN
    SELECT list_price INTO v FROM items WHERE item_id = p_id;
    RETURN v;
  END;
END;
/
OUTPUT
Package body created.

When the body is INVALID, USER_ERRORS tells you which line and name broke it. Fix the code first, then compile.

After the fixrun as lab_a
SET SERVEROUTPUT ON
EXEC DBMS_OUTPUT.PUT_LINE(pkg_item.price(1))
✓ SUCCESS
100

PL/SQL procedure successfully completed.

FAQ

What does ORA-06508 could not find program unit being called mean?

The package (or other unit) being called could not be run. Look at the error right above it: in the tests it was ORA-04067 when the body did not exist and ORA-04063 when the body had compile errors.

How do I find which package causes ORA-06508?

The message names it, for example "LAB_A.PKG_ORDER". Then check USER_OBJECTS for its PACKAGE and PACKAGE BODY status and USER_ERRORS for the compile errors.

Why does ORA-06508 appear after a column change or a DROP?

The package body depends on that table or function and becomes INVALID. In the tests, renaming a column and dropping a called function both made the next call fail with ORA-04063 and ORA-06508.

Is ALTER PACKAGE COMPILE enough to fix ORA-06508?

Only if the cause is gone. In the test, ALTER PACKAGE pkg_calc COMPILE BODY worked after the dropped function was recreated. For the renamed column, the body itself had to be changed.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0