Home › Database › PLS-00302: Component Must Be Declared — Causes and Fixes
Intermediate 3 min · November 09, 2026

PLS-00302: Component Must Be Declared — Causes and Fixes

PLS-00302 means Oracle found the package or schema but not the name inside it.

N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Notes here come from systems that actually shipped.

Follow
✓ Production
production tested
November 09, 2026
last updated
2,128
articles · all by Naren
Before you start⏱ 6 min
  • ✓PL/SQL packages basics
 ● Production Incident 🔎 Debug Guide
⚡Quick Answer
  • PLS-00302 = the package/schema was found, the name inside it wasn't.
  • Cause 1: declared only in the package BODY. Add it to the SPEC.
  • Cause 2: name mismatch: typo, or created with double quotes (case-sensitive).
  • Cause 3: name collision: a schema or local object with the same name as the package.
  • Check: SELECT procedure_name FROM all_procedures WHERE object_name = 'PKG';
✦ Definition~90s read
What is PLS-00302?

PLS-00302 is a PL/SQL compile error. Oracle resolves a dotted name such as pkg.func left to right; it found the first part but not the component after the dot. It usually arrives with ORA-06550, which gives the line and column.

★
You asked reception for 'Finance, Priya'.
Plain-English First

You asked reception for 'Finance, Priya'. Reception found Finance, but there's no Priya on the public directory: she's either not listed, spelled differently, or you reached the wrong Finance.

The function is in the code, yet every call fails with PLS-00302. Oracle doesn't see the code you see: it sees the package specification, under the name and schema it resolves.

How Oracle Resolves the Name

Oracle resolves a.b left to right: it finds a (a schema, package or variable in scope), then looks for b inside it. PLS-00302 means b wasn't found inside the a it chose.

call.sqlSQL
1
2
3
BEGIN
  v := agr_pkg.nbr_cgms_agrmnt(101);
END;
Output
ORA-06550: line 2, column 15:
PLS-00302: component 'NBR_CGMS_AGRMNT' must be declared
🎯 Key Takeaway
First part found, second not.

Cause 1: Not in the Spec

Only items declared in the package specification are visible outside the package.

spec.sqlSQL
1
2
3
4
CREATE OR REPLACE PACKAGE agr_pkg AS
  FUNCTION nbr_cgms_agrmnt(p_id NUMBER) RETURN NUMBER;
END agr_pkg;
/
🎯 Key Takeaway
Declare it in the spec.

Cause 2: Name Mismatch

A typo, or an identifier created in double quotes, which makes it case-sensitive and must then always be quoted.

names.sqlSQL
1
2
3
SELECT object_name, procedure_name
FROM all_procedures
WHERE object_name = 'AGR_PKG';
🎯 Key Takeaway
Match the exact name.

Cause 3: Name Collision

If a schema or local object has the same name as the package, Oracle may resolve to it and then fail to find the component. Qualify with the owner.

qualified.sqlSQL
1
v := fin_owner.agr_pkg.nbr_cgms_agrmnt(101);
🎯 Key Takeaway
owner.pkg.name.
● Production incidentPOST-MORTEMseverity: high

The Function That Was Only in the Body

Symptom
ORA-06550: line 42, column 30: PLS-00302: component 'NBR_CGMS_AGRMNT' must be declared.
Assumption
If the package body compiles, the function is callable.
Root cause
The function was declared only in the package body, making it private. The spec didn't list it.
Fix
Added the function declaration to the package spec and recompiled spec and body.
Key lesson
  • Callers see only the spec.
  • Check all_procedures for the package.
  • Compile spec and body together.
Production debug guideFind which cause2 entries
Symptom · 01
Name not in all_procedures
→
Fix
Not in the spec, misspelled, or in another schema.
Symptom · 02
Works when fully qualified
→
Fix
Name collision: a schema or object with the package's name.
⚙ Quick Reference
4 commands from this guide
FileCommand / CodePurpose
call.sqlBEGINHow Oracle Resolves the Name
spec.sqlCREATE OR REPLACE PACKAGE agr_pkg ASCause 1
names.sqlSELECT object_name, procedure_nameCause 2
qualified.sqlv := fin_owner.agr_pkg.nbr_cgms_agrmnt(101);Cause 3

Key takeaways

1
Callers only see the spec.
2
Check all_procedures.
3
Watch quoted identifiers.
4
Qualify with the owner on collisions.

Common mistakes to avoid

2 patterns
×

Body-only declaration

Symptom
PLS-00302 from callers.
Fix
Add to the spec.
×

Quoted identifiers

Symptom
Works only with exact case in quotes.
Fix
Avoid quoted names.
INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01SENIOR
What does PLS-00302 mean?
Q01 of 01SENIOR

What does PLS-00302 mean?

ANSWER
Oracle found the package or schema but not the named component; usually it's not in the package spec.
FAQ · 2 QUESTIONS

Frequently Asked Questions

01
How do I fix PLS-00302 component must be declared?
02
Why does ORA-06550 come with PLS-00302?
N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Notes here come from systems that actually shipped.

Follow
✓ Verified
production tested
November 09, 2026
last updated
2,128
articles · all by Naren
🔥

That's PL/SQL. Mark it forged?

3 min read · try the examples if you haven't

←
Previous
ORA-04063: Package Body Has Errors
32 / 32 · PL/SQL