Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Arrays as Parameters
A copy of this was sent to "Rishaal Jadoo" <rischalj_at_dp.new.iscorltd.co.za>
(if that email address didn't require changing)
On Thu, 1 Oct 1998 17:13:11 +0200, you wrote:
>Hi,
>
>I would like to pass arrays between PL/SQL stored procedures.
>
>The receiving package has been setup and compiles fine, expecting an array
>as a parameter.
>
>The calling stored procedure, however, refuses to compile saying that there
>is an incorrect type or number of arguments in the call.
>
>What is the syntax for the call ... at the moment, I just use the name of
>the array declared in the the calling stored procedure i.e.
>In the calling procedure :
>
>Type
>MyArr .... ;
>Parameter_Array My Arr;
>
>
>Call_Receiving_Proc(Parameter_Array);
>
>The sending and receiving arrays are of the same type.
>
>Thanks.
>
they both need to use the same base type. Here is an example:
create or replace package my_types
as
type myArray is table of number index by binary_integer;
end;
/
create or replace procedure proc1( x in my_types.myArray )
is
begin
for i in 1 .. x.count loop
dbms_output.put_line( x(i) );
end loop;
end;
/
create or replace procedure proc2
as
y my_types.myArray;
begin
for i in 1 .. 5 loop
y(i) := i;
end loop;
proc1(y);
end;
/
SQL> exec proc2
1
2
3
4
5
PL/SQL procedure successfully completed.
See how both use the SAME type -- my_types.myArray. If you have the type defined in 2 different places, even of the underlying definition is the same, they are different types...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Oct 01 1998 - 12:48:47 CDT
![]() |
![]() |