Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Arrays as Parameters

Re: Arrays as Parameters

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Thu, 01 Oct 1998 18:45:47 GMT
Message-ID: <3615cbf6.19606833@dcsun4.us.oracle.com>


On Thu, 1 Oct 1998 17:13:11 +0200, "Rishaal Jadoo" <rischalj_at_dp.new.iscorltd.co.za> 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.
>

Are they of the same type or are they just declared the same?

What I have found useful is to create a types package where I declare all my types and then reference them in the rest of my code.

eg.

create or replace package my_types is
  type arr is table of varchar2(10) index by binary_integer; end my_types;
/

create or replace package my_pack is
  procedure receiving( p_arr my_types.arr );   procedure calling;
end my_pack;
/

create or replace package body my_pack is   procedure receiving( p_arr my_types.arr ) is   begin
    dbms_output.put_line( 'cool' );
  end;
  procedure calling is
    l_arr my_types.arr;
  begin
    receiving( l_arr );
  end;
end;
/

I hope this helps.

chris.

>Thanks.
>
Received on Thu Oct 01 1998 - 13:45:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US