Hello,
I have a procedure which receive 2 parameters:
my_proc(param1 NUMBER, param2 my_table_type);
where my_table_type is table of my_type;
and my_type is record of (p1 number, p2 varchar2, p3 date, p4 number);
all of them are stored in a package.
when I execute:
declare
my_proc(111, my_table_type(123, 'aaa', to_date('02-FEB-2022','DD-MON-YY'), 444));
end;
I receive the error ORA-06550 PLS-00306: wrong number of types of arguments in call to my_table_type
Can you please help me with a hint?
Thank you!
There are a couple of issues here:
- my_table_type is an array of my_type. Each argument to my_table_type must be of type my_type, e.g.:
my_table_type ( my_type ( 123, 'aaa', to_date('02-FEB-2022','DD-MON-YY'), 444) )
- You're on 11g, but array/type constructor syntax is only available from 18c onwards. So you'll need to do something like:
declare
type my_type is record (
p1 number, p2 varchar2(100), p3 date, p4 number
);
type my_table_type is
table of my_type;
rec my_type;
arr my_table_type;
begin
rec.p1 := 123;
arr := my_table_type ();
arr.extend;
arr ( 1 ) := rec;
p ( arr );
end;
/