Confusion in the Collection

Hi gurus

I was reading a collection of topic of the doc oracle PL/SQL Collections and records and Steven Feuerstein and according to my understanding, there are 3 types of collections in oracle, associative, Nested table and Varray.

Collection types

1. associative array

It is one of oracle collection type and they are unlimited, dimensional and sparse collections unique homogeneous elements... These types of collection are only available in PL/SQL, and we cannot create through SQL. We can use multigames operator in this collection
Items in this collection type is in order.

We cannot be initialized

Nested table 2

It is one of the oracle collection type and here are single dimensional, without limit and the collection of homogeneous items. This type of collection is available in PL/SQL and SQL and we can also create it through SQL.
They are initially dense but can be scarce later through deletion. There is no order of the elements in the nested table.

We use multigames operator in this collection.

We have initialized.

3 - Varray
It is one of the oracle collection type and here are single dimensional, bounded and the collection of homogeneous items. This type of collection is available in PL/SQL and SQL and we can also create it through SQL.
They are always dense. Whenever you define this type of collection you mention always the maximum no of items. Items in this collection type is in order.

We cannot use multigames operator in this collection

My question is that when we use these types of collections? I know only Varray collection, we can use it when we know the upper limit of the elements, but I confuse myself in Nested table and associative. It seems that the two are the same except that we can create Nested table via database level, but in the case of an associative array, we cannot create it.

More we can perform the string indexing on the location of items in an associative array using the index clause, but in the case of nested by default on PLS_integer indexing table and we can perform localization of indexing on the strings.

I appreciate if someone tell me when the associative array is used and when we use the nested table. Thanks in advance

Concerning

Muzz

table.

Muzz says:

Thanks for the responses,

@Billy, thanks for the nice collection, but still confusing explanation as to where we need to use the standard collection and where we need to use the associative collection?...

A table has cells or elements. It also has a way for you to refer to the cell in the table.

A normal array uses a sequential numbering of addressing or SEO, the cells in the table. In many languages the numbering starts at 0, in PL/SQL it starts at 1.

A table will look so conceptually as follows (index = item)

1 = John

2 = Jack

3 = Scott

So in PL/SQL, the following can be used to refer to the first question/cell in the table:

dbms_output.put_line( '1st item='|| array(1) );

Or we can add a new item in the table as follows:

array.Extend(1);    -- add a new iterm, e.g. item 2
array( array.Count ) := 'foo'; -- array.Count is now 2 so we are using array(2) as reference

Referring to a standard table is so easy - usually all that is needed to browse a table:

for i in 1 .. array.Count loop
  -- do something with array item array(i)
end loop;

An associative array is a name-value pair. Here is an example of name-values (from list of symbols for the NYSE [NYSE]):

AAC = Aac Holdings Inc.

AAN is Inc.. Aaron

ABR = Arbor Realty Trust

To refer to an element in the table, we need to use the name for this value. For example

dbms_output.put_line( 'AAC='|| array('AAC') );

To add or update a name value:

array('AAT') := 'American Assets Trust';

If there is no name (reference) for the "AAT" string, a new name-value is added in the table. If there is already such a reference, its value is updated.

There almost never associative tables in PL/SQL. 99% of the code that I see with the help of associative arrays is bad, because it is used a standard table with sequential numbering as reference of array index.

Associative arrays are useful when receive and process the application name values. An example would be dealing with an allowed web PL/SQL and creating an associative array for the State and the CGI (Common Gateway Interface) variables for the current run.

Tags: Database

Similar Questions

  • What is the collection "Images Lightroom" on Mobile with Lightroom?

    Every time I synchronize a collection with my Android all synchronized seem to be automatically added to a collection/folder (?) called «Lightroom Photos» Even after I stop a collection of synchronisation all photos will remain visible in the section 'Photos Lightroom'. How can I stop this? Being given "Lightroom photos" is not a true collection (and also not visible in the desktop application but only on my adroid) I can't remove it or do something else with it. All the options I have are "add photo" and "Start slide show".

    Mobile Lightroom is just an opinion and should not be confused with the Collections.

    Try to add an image to your desktop in a collection that is also synchronized with mobile phone.

    You should find the image in the collection on your mobile phone once synchronized, and it will also appear in the display of photos of Lr.

    ~ ~ Assani

  • Need help to understand the collection

    Hi all

    I'm trying to understand the concept of collection, but when I look in the documentation that exists in google.ca, then, it seems very confusing. If someone suggest me or send me some simple examples and good collection and I really appreciate it. Thanks in advance.

    Concerning

    Line

    Thanks for the explanation, could you please explain what does really to take care of the index as a whole and clause varchar2 and if yes then what condition we use varchar2 index and in which condition we use index as a whole, be we just use index by integer in our daily practice. Really appreciate your response. Thank you

    Generally if you use collections, especially PL/SQL-only collections, your architecture is probably wrong. Collections are rarely necessary, but are often USED in the mistaken belief that they will help performance.

    The use of the collections usually DEGRADES performance, sometimes severely, and they are often used in a way that is not scalable. You should avoid using collections if possible.

    So don't use the collections AT ALL in your 'common practice '.

    For the rare cases where there is to use an array associative index type to use depends on the data type of the element that you will use for the index. If you plan to use a string, then you use INDEX OF VARCHAR2. If you plan to use an integer, then you use INDEX BY PLS_INTEGER.

    What type of index to use has NOTHING to do with performance.

    One of the WORST mistakes developers make is to use an associative array as target of a BULK COLLECT INTO instead of using a TABLE IMBRIQUEE. Collection in bulk is more often used in a FORALL statement so that the elements are accessible only in the order. Useds "indexed" access with associative arrays isn't even necessary or used.

  • How to export the collected addresses

    I carried on a new machine (win 7). I have properly exported and imported my address book that contains only 7 entries in my opinion.
    It is now only that I realize that Thunderbird uses the addresses of his "collected addresses" for a long time to suggest the person in the address bar, and that all of these hundreds of addresses are not registered in my address book.
    How can I get access to my (what must be hundreds of) "collected addresses" and get them on my new machine?

    Thank you

    Opens the address book, then select Tools-Export. Select the collected book to export.
    http://KB.mozillazine.org/Moving_address_books_between_profiles

  • Suddenly, my Thunderbird does not list the collected addresses and don't 'Always allow remote content' addresses.

    (1) under address book, used for the book of MAC OS X, as well as the collected addresses and a third list, I can't remember.
    Now it lists only MAC OS address book.

    "(2) if I click on"Always allow remote content"it won't let me click on 'OK', I think that it says in the top left corner" adds: "but gives me an empty list.

    Thank you!

    If I'm more mac savy you we're in trouble. The last Mac I used has a black and white screen and used the floppy 3 1/2 "

    See Troubleshooting in the Thunderbird Help menu, and then click the display folder of your profile (Thunderbird knows where he is, even if I'm not) the History.mab file is your collected addresses.

  • Confusion about the Source of excitement in the bridge SMU-4331 input module

    Hello

    I had some confusion through the input of the bridge SMU-4331 sheet module.

    In the features section of excitement, its current Minimum as 29mA says. What it means. It can only current greater than 29mA delivery!

    I think this should me Maximum current specification.

    If you look at the table below

    350 ohm resistance, the current should be 10V/350 ohm = 28.5mA

    but for 1 K ohm, current will me 10V/1Kohm = 10mA, which isn't normal, if you specify current minimum as 29mA.

    any thoughts?

    Kind regards

    Mirash

    Hello Mirash,

    I'm glad I could help!

    As for your other question, the SMU-4330/4331 are inherently peripheral ratiometric.  This means that they are designed to detect the level of excitement and range of the ADC to the appropriate scale.  In this way, we can compensate for permanent changes in the voltage.  One of our engineers wrote a big article really nice area on the subject I would recommend that you take a look at: Sensors of Measuring Bridge-Based with the ratiometric approach

    See you soon,.

  • Unable to see the Collections in remote desktop Services in Server Manager

    It doesn't seem to be a category for Windows Server for some reason, so I apologize if this is in the wrong category:

    We recently had an administrator leave our of the it group, and he was the one who had set up our fund services / remote server.  Recently, we wanted to deploy another remote application and found that we were not able to see the "Collections" option in the server in remote desktop services manager.  The only option listed is "servers".  However to reactivate the account administrator and the server like him gave us all permissions to see the option of Collections and to deploy another remote application.

    My question would be, this is a policy of setting Group / somewhere that is limiting the other users of the full access to Office services in Server Manager remotely.  I looked everywhere on the server (and google) to see if I could find where this setting is vain.  Any suggestions/help would be greatly appreciated.

    Thank you!
    Heda

    Hello

    Server forums are in an another Microsoft Community to it.

    This community is mainly for users.

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • Win2012 Server. Y at - it a shortcut to reach the Collections to the remote desktop Services without going through the Server Manager

    Win2012 Server. Y at - it a shortcut to reach the Collections to the remote desktop Services without going through the Server Manager?

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • How can I change the color of the plots (lines, points) in the collection Scattergraph plot

    For example, I go through a foreach loop and draw two points. How to distinguish this set of plots of the yet to come? How can I change the style, color and have separate lines (instead of on the line connecting everything) for each of my plots? I don't know how to set everything up, but it still does what he wants to do. TIA.

    Hello

    The problem you see occurs because of the following lines of code:

    The _data and _data2 scatterPlot3 value

    _data = scatterPlot3

    _data2 = scatterPlot3

    When you do this, you define _data as _data2 to reference an object of the simple concession - scatterPlot3.  Yes, even if you have (from the code you have posted at least) three slots in your collection, they are all pointing to the same object of point cloud.  So when you change the color for one, it changes the color for them all.  However, I think that you have fallen on the right solution in your last sentence.  If you want to have multiple locations on your ScatterGraph, each with its own color and style, they should each be separate and unique plots in the collection plot of your ScatterGraph.  Based on the code you posted, you'll see this if you comment just the two lines shown above.

    Please let me know if something is still uncertain.

    NickB

    National Instruments

  • Anyone has an idea how to manually remove items that do not appear in the Collection, but take place on the device. Specifically, an audio book downloaded via Overdrive?

    Anyone has an idea how to manually remove items that do not appear in the Collection, but take place on the device.  Specifically, an audio book downloaded via Overdrive?

    Hello

    1. what type of files are in the audio book? Could you provide me with the file extensions?
     
    If you delete the information or files audio books could not show some information. I wouldn't recommend allows you to delete the files. If you want to remove them, you can contact overdrive support.

    Hope this information helps.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • When I start the Director I get "the collection of files its not valid or its corrupted. A new empty collections file has been created ".

    I've been using Director windows 2.6 on my operating system from vista for several months.   I just did the upgrade to windows 7 and now I get this message.

    "The collection file is not valid or its corrupted." A new empty collections file has been created "."

    Then, it closes the program.

    I had to rename a file called FFDshow.ax to another program called Muvee AutoProducer 6.1 works but I do not see how would the file collections of this program.

    Help, please.

    Thank you...

    For any question on Windows 7:

    http://social.answers.Microsoft.com/forums/en-us/category/Windows7

    Link above is Windows 7 Forum for questions on Windows 7.

    Windows 7 questions should be directed to / stationed there.

    You are in the Vista Forums.

    See you soon.

    Mick Murphy - Microsoft partner

  • Try to install Windows 7 but the grip to install in the "collection of information".

    suspended in the "collection of information".

    Try to install Windows 7, suspended in the "collection of information".  Any suggestions?

    How long you wait to determine that she is hooked on collecting the information?

    You try to upgrade or clean installation?

    You disconnect all devices non-essential connected to the computer before attempting the installation?

    If you are upgrading from a previous version of Windows:

    1 disable any security software before attempting to upgrade
    2. make sure that your computer is updated (devices and applications)
    3. disconnect all external devices before installing.
    4. check your hard disk for errors:
    Click Start
    Type: CMD, according to the results, right-click CMD
    Click on "Run as Administrator"
    At the command prompt, type: chkdsk /f /r
    When you restart your system, your computer will be scanned for errors and will try to correct them.

    1. click on start, type msconfig in the search box and press ENTER.
    User account control permission
    If you are prompted for an administrator password or a confirmation, type the password, or click on continue.
    2. in the general tab, click Selective startup.
    3. under Selective startup, clear the check box load startup items.
    4. click on the Services tab, select the hide all Microsoft Services check box, and then click Disable all.
    5. click on OK.
    6. When you are prompted, click on restart.
    7. after the computer starts, check if the problem is resolved.

    Also run the Windows 7 Upgrade Advisor:
    http://www.Microsoft.com/Windows/Windows-7/Upgrade-Advisor.aspx

  • Confused about the notion of VLAN

    I'm confused about the VLAN. I thought that the notion of VLAN was this computer on different VLANS were not suppose to be able to communicate with each other. I am setting up a 6248 and for me to get DHCP to work, I need to enable ip Routing. When I turn the routing ip, all computers on different VLANS are able to ping each other. Is - it the way it was suppose to work, or am I missing something?
    MGMT is on vlan 4093
    DHCP is on VLAN 100 trunk e34 10.10.1.1
    Host 1 is on VLAN 200 trunk e34 10.10.2.1
    Host 2 is on VLAN 300 trunk e34 10.10.3.1
    active IP routing

  • Extremely confused with the extremely complicated presentation of BlackBerry applications

    Please help me, I'm very confused with the extremely complicated presentation of BlackBerry applications.

    I made an app, the name is "App", I got signed and downloaded the App using the emulator Ripple, with the word 'HelloWorld' signature (password not true of course).

    Now, I do another application, with the name of the App (B) I CAN'T use the same HelloWorld signature password because the emulator Ripple said "Oh, Snap!" Build request failed with the message: [ERROR] error: Code signing request failed because this version of the application or the package has been previously signed. If please increment the version (s) and try to connect again. »

    Now, I don't understand and I am EXTREMELY confused with the presentation of the model of application for Blackberry.

    I should first request, for an another RDK and COMINCO files create a new signature for App B password?

    Or should I just increment the bundle version? the problem is when I tried it on Blackberry server seems to give narrations of error message that the APP ID is already used.

    Okay, I'm officially stuck and I don't know what to do. Can any developer of blackberry here or the official employee blackberry tells me what I need to do?

    Thank you.

    I do not use ripple either but can see what the problem is (nothing to do with the ripple)

    Open your file config.xml for the new project (probably copied 'App A'?)

    In the widget section, change the id to something different, for example com.example.AppB

    Save - reload the ripple and make sure you have the new ID in the Config-> Widget

    All sorted

  • Confusion over the number of tunnels

    Hi all

    I'm very confused about the number of tunnels formed in my ASA 5520. By CLI, I see two IPSec tunnels, but through ASDM, I get the data you see in the attached picture. Someone knows about it. Thank you

    VPN-ASA5520-BLUR # sh vpn-sessiondb summary

    Summary of the current Session

    Sessions:
    Active principles: Cumulative: simultaneous peak: inactive
    SSL VPN               :       0 :         20 :               3
    Clientless only: 0: 3: 1
    Client: 0: 17: 2: 0
    IPsec remote access: 2:10:2
    Totals: 02:30

    Information about the license:
    IPsec: 750 configured: 750 Active: 2 load: 0%
    SSL VPN: 25 configured: assets 25: 0 load: 0%
    Active principles: Cumulative: simultaneous peak
    IPsec               :          2 :         10 :               2
    SSL VPN             :          0 :         20 :               3
    Totals              :          2 :         30

    NAC Active Sessions:
    No NAC session to display

    Mapping sessions VLANS active:
    No session mapping VLAN to display
    VPN-ASA5520-BLUR # sh clock
    07:58:34.698 METS Tuesday, June 12, 2012
    VPN-ASA5520-BLUR.

    The output of the ASDM is likely to match the output of 'see the vpn-sessiondb' without the key word "Summary", which also include VPN IPSec LAN - to - LAN both tunnels.

Maybe you are looking for