| PLS-00306: wrong number or types of arguments in call [message #195544] |
Fri, 29 September 2006 07:18  |
gold_oracl
Messages: 127 Registered: July 2006 Location: Westborough, MA
|
Senior Member |
|
|
Hi all,
please check the following snipset.
create or replace package gold_pk
is
type type_a is table of varchar2(20) index by binary_integer;
procedure gold_proc(aa out type_a);
end;
create or replace package body gold_pk
is
procedure gold_proc(aa out type_a)
is
begin
aa(1) := 'Gold';
aa(2) := 'Nice';
end;
end;
create or replace procedure gold_proc1
is
type type_a is table of varchar2(20) index by binary_integer;
t_a type_a;
begin
gold_pk.gold_proc(t_a);
dbms_output.put_line(t_a(1));
dbms_output.put_line(t_a(2));
end;
LINE/COL ERROR
-------- -----------------------------------------------------------------
6/1 PLS-00306: wrong number or types of arguments in call to
'GOLD_PROC'
6/1 PL/SQL: Statement ignored
how to modify the above code to get out of this error.
Thanks,
Thangam
|
|
|
|
| Re: PLS-00306: wrong number or types of arguments in call [message #195548 is a reply to message #195544] |
Fri, 29 September 2006 07:43   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
The Type TYPE_A that you have defined in the package Gold_Pk is not the same as the Type defined in your procedure.
It looks the same, and is functionally identical but it is a different type.
Tho fix this, change the procedure to use the type defined in the package:
create or replace procedure gold_proc1
is
t_a gold_pk.type_a;
begin
gold_pk.gold_proc(t_a);
dbms_output.put_line(t_a(1));
dbms_output.put_line(t_a(2));
end;
|
|
|
|
| Re: PLS-00306: wrong number or types of arguments in call [message #195561 is a reply to message #195548] |
Fri, 29 September 2006 08:10   |
gold_oracl
Messages: 127 Registered: July 2006 Location: Westborough, MA
|
Senior Member |
|
|
Thanks you very much JRowbottom:
However, here both the diclaration coded in package and procedure are same.
check below:
package:
type type_a is table of varchar2(20) index by binary_integer;
Procedure:
type type_a is table of varchar2(20) index by binary_integer;
Infact i just did copy and paste, why oracle does not accepting like this?
Thanks,
Thangam
|
|
|
|
| Re: PLS-00306: wrong number or types of arguments in call [message #195564 is a reply to message #195561] |
Fri, 29 September 2006 08:19  |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Because it is a different type.
Just because it has the same structure and name doesn't make it the same actual Type.
It's all to do with dependency checking and invalidation.
If everything that uses the Gold_pk also has to reference the Gold_pk.type, then if that type is changed, Oracle knows what needs to be invalidated and recompiled.
If you do what you tried, then Oracle doesn't neccesarily know that your procedure needs to be invalidated, as it doesn't reference the Type that has been changed.
|
|
|
|