Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Multi-dimensional Array
Thanks. But I do have a problem in using this because:
(1) I need to have a multi-dimensional array up to 12 parameters; and
(2) It's not easy to proof that the mapping function is 1-to-1.
Thanks.
"Ed Prochak" <edprochak_at_adelphia.net> wrote in message
news:3E7B6418.9060100_at_adelphia.net...
> M wrote:
> > pl/sql table is only single-dimension. for example,
> >
> > declare
> > type score_type is table of number(3) index by binary_integer;
> > my_score score_type;
> > begin
> > for a in 1 .. 100 loop
> > my_score(a) := a;
> > end loop;
> > end;
> >
> > Then I can assign values to my_score(a), a single-dimension array. Just
> > want to know if there is something like, e.g. 2-dimensional arrays like
> > my_score(a, b) ... or even multi-dimensional.
> >
> > M.
> >
> > "Jim Kennedy" <kennedy-downwithspammersfamily_at_attbi.com> wrote in
message
> > news:U1lda.141918$S_4.82850_at_rwcrnsc53...
> >
> >>How about using pl/sql tables?
> >>Jim
> >>"M" <someone_at_microsoft.com> wrote in message
> >>news:b53ej3$2144$1_at_news.hgc.com.hk...
> >>
> >>>Hi all,
> >>>
> >>>Just want to know in Oracle 8i, can I define some multi-dimensional
> >>
> > array
> >
> >>to
> >>
> >>>store data for analysis purpose. Can this kind of array be define on
> >>
> > the
> >
> >>>fly, instead of some objects in the database?
> >>>
> >>>Thx.
> >>>M.
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
>> ----- 440-498-3702
> ----- INDEX2D
> ----- GIVEN THE INDICES IN A 2-DIMENSIONAL ARRAY.
> ----- THIS RETURNS A UNIQUE INDEX IN A LINEAR ARRAY.
> -----
> ----- Ed Prochak
> ----- Magic Interface, Ltd.
>
>
>
>> END;
> DECLARE
> TYPE EJP_TABLE IS TABLE OF VARCHAR2(30)
> INDEX BY BINARY_INTEGER;
> LYNEAR EJP_TABLE;
> BEGIN
> LYNEAR(2):='TWO'; --- IT REALLY IS A LINEAR ARRAY
> LYNEAR(INDEX2D(1,2)):='xxx'; --- but INDEX2D allows you to pretend
it's 2D
> LYNEAR(INDEX2D(2,2)):='YYY';
> LYNEAR(INDEX2D(3,5)):='ZZZ'; --- GREAT FOR SPARSE MATRICES TOO.
>
> DBMS_OUTPUT.PUT_LINE('@(2) = '|| LYNEAR(2) );
> DBMS_OUTPUT.PUT_LINE('@(1,2)) = '||LYNEAR(INDEX2D(1,2))||
> ' @'||INDEX2D(1,2) );
> DBMS_OUTPUT.PUT_LINE('@(2,2)) = '||LYNEAR(INDEX2D(2,2))||
> ' @'||INDEX2D(2,2) );
> DBMS_OUTPUT.PUT_LINE('@(3,5)) = '||LYNEAR(INDEX2D(3,5))||
> ' @'||INDEX2D(3,5) );
>
>
> >
>
> >
![]() |
![]() |