Home » SQL & PL/SQL » SQL & PL/SQL » calling type inside package (oracle 9.2.0.3 ,xp)
calling type inside package [message #403853] Tue, 19 May 2009 04:04 Go to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
When calling the type defined inside package from java application
I am getting invalid name error while when the type is created and outside the package it is working fine.

I call the type inside package by packagename.typename .Why its happening? Is it a privilege problem?

-prachi
Re: calling type inside package [message #403858 is a reply to message #403853] Tue, 19 May 2009 04:26 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you posted the actual statement it would be easier to answer.
In short you cannot refer a PL/SQL type inside a SQL statement.

Regards
Michel
Re: calling type inside package [message #403859 is a reply to message #403853] Tue, 19 May 2009 04:27 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Inside package???
Body or Specification?
How you are calling from Java? Code snippet would be helpful.

By
Vamsi
Re: calling type inside package [message #403861 is a reply to message #403859] Tue, 19 May 2009 04:51 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
Inside specification...
Re: calling type inside package [message #403862 is a reply to message #403861] Tue, 19 May 2009 04:54 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Quote:
How you are calling from Java? Code snippet would be helpful.

By
Vamsi
Quote:
If you posted the actual statement it would be easier to answer.
In short you cannot refer a PL/SQL type inside a SQL statement.

Regards
Michel

Is your code kind of confidential?

It would be better, if your next post have the following
1. Type definition
2. Java code
3. Error

By
Vamsi

[Updated on: Tue, 19 May 2009 04:56]

Report message to a moderator

Re: calling type inside package [message #403897 is a reply to message #403862] Tue, 19 May 2009 07:37 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
Java code:
Connection conn = getDBConnection();
			try{
		        int a[]= {10001,10003,10004};
			ArrayDescriptor descriptor =ArrayDescriptor.createDescriptor("PACKAGE1.MYARRAY", conn );
	ARRAY arraystr =new ARRAY( descriptor, conn, a);
			CallableStatement callableStatement = conn.prepareCall("{call PACKAGE1.TEST(?,?,?)}");
callableStatement.setArray(1,arraystr);
..


pl/sql code:
CREATE OR REPLACE PACKAGE1 AS

TYPE MYARRAY IS TABLE OF NUMBER;
...

PROCEDURE TEST ( IN_PARAM IN MYARRAY,IN_DEPTID IN NUMBER, OUT_OUTARRAY  OUT MYARRAY1 ) ;
...


error:Invalid name PACKAGE1.MYARRAY

but if I create the type outside the package and call it then , its working fine

[Updated on: Tue, 19 May 2009 07:37]

Report message to a moderator

Re: calling type inside package [message #403898 is a reply to message #403897] Tue, 19 May 2009 08:08 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Some Google hits, which can help...
One says you can't use this way.
Another says you can use varray (not sure inside/outside the package) instead of type.

By
Vamsi
Re: calling type inside package [message #403902 is a reply to message #403898] Tue, 19 May 2009 08:32 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
if I create the type outside the package and call it then , its working fine .
Re: calling type inside package [message #403904 is a reply to message #403902] Tue, 19 May 2009 08:39 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is what we said, you can't do it with package types.

Regards
Michel
Previous Topic: calculate Days Between
Next Topic: Difference between array and varray
Goto Forum:
  


Current Time: Sun Dec 04 16:41:18 CST 2016

Total time taken to generate the page: 0.17871 seconds