Re: Is it possible to have an array in a table?

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: Sun, 23 Aug 2009 00:34:35 -0700 (PDT)
Message-ID: <e2329a85-b17c-4a5f-8e90-e5e4c2f63d9f_at_a26g2000yqn.googlegroups.com>



On Aug 23, 10:39 am, Ramon F Herrera <ra..._at_conexus.net> wrote:
> On Aug 22, 4:46 pm, John Hurley <johnbhur..._at_sbcglobal.net> wrote:
>
> > On Aug 22, 4:09 pm, Ramon F Herrera <ra..._at_conexus.net> wrote:
>
> > snip
>
> > > Bonus question:
>
> > > I believe it is possible to save an arbitrary file (let's say an MS
> > > Word or PDF document) in Oracle. I'd appreciate the details on that.
>
> > > TIA,
>
> > > -Ramon
>
> > asktom.oracle.com ... which also applies to your first question.
>
> Thanks, John. That is indeed a helpful resource.
>
> In reference to arrays (or VARRAYs) I have a question for you folks
> out there. According to the examples that I read, a VARRAY can be used
> when there is a small number of items. The example mentions a person/
> organization with a variable number of phone numbers, of to 6.
>
> What about a larger number of items? In that case, is it:
>
>  - inefficient
>  - inelegant
>  - undesirable
>  - not recommended
>
> to use VARRAYs perhaps?
>
> The characteristic that I value the most about arrays is the ability
> to iterate with an integer(s). Also important is the fact that if an
> item is in position 52, I can rely on it being there next time.
>
> TIA,
>
> -Ramon

Read up on nested tables and associative arrays in the docs for your Oracle release. Note that true arrays (associative arrays aka INDEX BY tables) are only available in PL/SQL. VARRAYs are somewhat limited because they have finite predeclared capacity (you must declare maximum VARRAY size,) and nested tables are unordered unless you include an index column, always ORDER BY that index and maintain it yourself. VARRAYs are stored in LOBs, so they become a bit less efficient as they grow, but not dramatically.

Regards,

   Vladimir M. Zakharychev
   N-Networks, makers of Dynamic PSP(tm)    http://www.dynamicpsp.com Received on Sun Aug 23 2009 - 02:34:35 CDT

Original text of this message