Home » Other » General » Error 302: Component must be declared (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod, Windows XP)
Error 302: Component must be declared [message #418752] Tue, 18 August 2009 08:30 Go to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
Hi
I am getting Error 302: Component "..." must be declared error whenever i qualify a schema name with table, functions, procedure etc. eg if i declare a variable as:

v_temp SCHEMA_NAME.TABLE_NAME.FIELD_NAME%TYPE;
and compile it i get
Error 302: Component "..." must be declared error

however if i remove the scehma name and do it as:
v_temp TABLE_NAME.FIELD_NAME%TYPE;
then it complies fine.

Please note that this problem is occuring in only one user/schema.
Any help
Re: Error 302: Component must be declared [message #418756 is a reply to message #418752] Tue, 18 August 2009 08:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
No enough data to compute.

Where do you get this error?

Regards
Michel
Re: Error 302: Component must be declared [message #418760 is a reply to message #418752] Tue, 18 August 2009 08:58 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
i am getting this error in the database function
Re: Error 302: Component must be declared [message #418761 is a reply to message #418760] Tue, 18 August 2009 09:03 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
From where do you get the error? Which client?
"Error 302: Component " is not a database error.

Regards
Michel
Re: Error 302: Component must be declared [message #418762 is a reply to message #418752] Tue, 18 August 2009 09:03 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
soory the actuall error code is :
pls-00302 component must be declared
Re: Error 302: Component must be declared [message #418774 is a reply to message #418762] Tue, 18 August 2009 09:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Without the actual code the only thing we can say is
Quote:
PLS-00302: component "string" must be declared
Cause: In a reference to a component (for example, in the name "A.B", "B" is a component of "A"), the component has not been declared. The component might be misspelled, its declaration might be faulty, or the declaration might be placed incorrectly in the block structure.
Action: Check the spelling and declaration of the component. Also confirm that the declaration is placed correctly in the block structure.

Regards
Michel
Re: Error 302: Component must be declared [message #418775 is a reply to message #418752] Tue, 18 August 2009 09:20 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
FUNCTION MGR_OTT_APT_APPROVE (pWEEKENDING DATE, pRCODE VARCHAR2, FLAG VARCHAR2) RETURN VARCHAR2 IS

vUUID	EMPIRE.MGMT_USRRCREF.UUID%TYPE;

i am getting the error on above declartion
but if i declare it as:
vUUID	MGMT_USRRCREF.UUID%TYPE;

then it works fine
Re: Error 302: Component must be declared [message #418782 is a reply to message #418752] Tue, 18 August 2009 09:25 Go to previous messageGo to next message
cookiemonster
Messages: 13958
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) do you have a schema called EMPIRE?
2) does the user you're trying to compile the function as have permissions to see empires objects?
Re: Error 302: Component must be declared [message #418787 is a reply to message #418752] Tue, 18 August 2009 09:42 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
Quote:

1) do you have a schema called EMPIRE?


yes

Quote:

2) does the user you're trying to compile the function as have permissions to see empires objects?


the function is in Empire (function and the table are in the same user)
Re: Error 302: Component must be declared [message #418803 is a reply to message #418787] Tue, 18 August 2009 10:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Maybe the error is not there you think it is.
Use SQL*Plus and copy and paste your session.

Regards
Michel
Re: Error 302: Component must be declared [message #418806 is a reply to message #418752] Tue, 18 August 2009 10:36 Go to previous messageGo to next message
cookiemonster
Messages: 13958
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have you got an object called EMPIRE (apart from the schema)?
Re: Error 302: Component must be declared [message #418810 is a reply to message #418752] Tue, 18 August 2009 10:43 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
no
Re: Error 302: Component must be declared [message #418811 is a reply to message #418810] Tue, 18 August 2009 10:52 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Michel Cadot wrote on Tue, 18 August 2009 17:30
Maybe the error is not there you think it is.
Use SQL*Plus and copy and paste your session.

Regards
Michel


Re: Error 302: Component must be declared [message #418812 is a reply to message #418752] Tue, 18 August 2009 10:58 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
no use. same error even in SQL plus
Re: Error 302: Component must be declared [message #418813 is a reply to message #418752] Tue, 18 August 2009 10:59 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
we even get the same error on forms (10g) if we qualify the schema.
Re: Error 302: Component must be declared [message #418819 is a reply to message #418812] Tue, 18 August 2009 11:12 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
waqasbhai wrote on Tue, 18 August 2009 17:58
no use. same error even in SQL plus

If you say so.
But why don't you post it?

Before please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel

Re: Error 302: Component must be declared [message #418821 is a reply to message #418752] Tue, 18 August 2009 11:21 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
Quote:

But why don't you post it?


what should i post?

I already told you that i m getting this error where ever i qualify the schema with any object (table, procedure, function...) and the error is only occuring in this particular user.
And by the way i've already read the guide.
Re: Error 302: Component must be declared [message #418822 is a reply to message #418821] Tue, 18 August 2009 11:32 Go to previous messageGo to next message
cookiemonster
Messages: 13958
Registered: September 2008
Location: Rainy Manchester
Senior Member
waqasbhai wrote on Tue, 18 August 2009 17:21
Quote:

But why don't you post it?


what should i post?

I already told you that i m getting this error where ever i qualify the schema with any object (table, procedure, function...) and the error is only occuring in this particular user.
And by the way i've already read the guide.


A complete copy and paste of the procedure creation and the output from show errors. That way we could see exactly which component it's complaining about. I'm guessing it's the table name but haven't actually stated that.

I still think you've got an object called EMPIRE, becuase I can't think of any other explaination for this error.
e.g.:
Connected to:
Oracle Database 10g Release 10.2.0.2.0 - 64bit Production

SQL> sho user
USER is "LIVE"

SQL> create table test (a number);

Table created.

SQL> create table live (b number);

Table created.

SQL> create or replace procedure testproc as
  2  
  3  l live.test.a%TYPE;
  4  
  5  begin
  6  
  7  null;
  8  
  9  end;
 10  /

Warning: Procedure created with compilation errors.

SQL> sho errors procedure testproc
Errors for PROCEDURE TESTPROC:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/3      PL/SQL: Item ignored
3/8      PLS-00302: component 'TEST' must be declared
SQL> 
SQL> drop table live;

Table dropped.

SQL> alter procedure testproc compile;

Procedure altered.

SQL> sho errors procedure testproc
No errors.
SQL> 


Run the following to be sure:
SELECT * from all_objects where object_name = 'EMPIRE';
Re: Error 302: Component must be declared [message #418824 is a reply to message #418752] Tue, 18 August 2009 11:46 Go to previous messageGo to next message
waqasbhai
Messages: 118
Registered: August 2008
Location: Pakistan
Senior Member
sorry you were rite
there was an object with the same name as user(empire)
thanks
Re: Error 302: Component must be declared [message #418833 is a reply to message #418824] Tue, 18 August 2009 12:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
waqasbhai wrote on Tue, 18 August 2009 18:46
sorry you were rite
there was an object with the same name as user(empire)
thanks

Now you know why we want you to copy and paste what you have and not just tell us.
You think you're right in your interpretation byt you were wrong.

Regards
Michel
Re: Error 302: Component must be declared [message #476204 is a reply to message #418752] Wed, 22 September 2010 01:28 Go to previous messageGo to next message
qpriya
Messages: 2
Registered: September 2010
Junior Member
hi
don use object name which u declared within the procedure.
for ex: u declred total integer in procedure then just use
total to print. don use objectname.total
Re: Error 302: Component must be declared [message #476205 is a reply to message #476204] Wed, 22 September 2010 01:33 Go to previous messageGo to next message
qpriya
Messages: 2
Registered: September 2010
Junior Member
total integer;
pre det%rowtype;
dbms_output.put_line(total);
try this.
Re: Error 302: Component must be declared [message #476212 is a reply to message #476205] Wed, 22 September 2010 02:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
don use object name which u declared within the procedure.

Does not compute, who are "don" and "u"?
About 1 word out of 2 is not in the dictionary.
Please read OraFAQ Forum Guide and do not use IM speak and format your query.

Regards
Michel

[Updated on: Wed, 22 September 2010 02:06]

Report message to a moderator

Re: Error 302: Component must be declared [message #476217 is a reply to message #476205] Wed, 22 September 2010 02:35 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
qpriya wrote on Wed, 22 September 2010 08:33
total integer;
pre det%rowtype;
dbms_output.put_line(total);
try this.

Are you asking a question, or are you answering a question that was never asked?
Previous Topic: Data Dictionary to Wiki
Next Topic: Oracle SQL Developer Data Modeler - Now free
Goto Forum:
  


Current Time: Fri Nov 22 16:12:38 CST 2024