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: PL/SQL Arrays

Re: PL/SQL Arrays

From: Richard Kuhler <noone_at_nowhere.com>
Date: Wed, 19 Nov 2003 19:18:47 GMT
Message-ID: <rmPub.58299$pE3.15150@twister.socal.rr.com>


Richard Kuhler wrote:
> 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;

As soon as I hit send, I realized my solution of course points at another solution if you're willing to have a public global variable ...

empty_numarray numarray;
procedure wrap (p_numbers in numarray := empty_numarray);

I'm not sure I like this solution since anybody could screw with that variable and change the default behavior of that procedure in their session. However, that might actually be desirable in some situations.

--
Richard
Received on Wed Nov 19 2003 - 13:18:47 CST

Original text of this message

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