Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Arrays
Jeremy wrote:
> Say you have the following:
>
> typecreate or replace package my_util
> is
> type numarray is table of number index by binary_integer;
> procedure wrap
> (p_numbers in numarray);
> end my_util;
>
> You cannot say "numarray default null" so you are obliged to pass at
> least some parameters to procedure "wrap" when you call it. I am sure
> there is a way around this - how should I define things so that I don't
> have to always pass some value?
I'll mention that if this weren't an index by collection it would be simple. You could do either of these depending on how you wanted it to work ...
procedure wrap (p_numbers in numarray := numarray()); procedure wrap (p_numbers in numarray := null);
With an index by collection, I think you're going to need to overload the procedure. Add a new procedure in addition to the procedure you already have ...
procedure wrap;
then define that procedure body as simply ...
procedure wrap is
empty_numarray numarray;
begin
wrap(empty_numarray);
end;
-- RichardReceived on Wed Nov 19 2003 - 13:13:39 CST