Data Management

On Object Types in Collections

Date Added: Jan 2010
Format: HTML

Below are given a few instances how objects can be retrieved in the best possible way. Firstly, to retrieve the third field (object type) from the varray, one consider an example of food paradigm. First an object type is created for general food things. Its three attributes help in keeping a track of the name of the food item, its food group, and the color of the food. Then take to populating the varray. Constructor functions are employed to create object type instances with the assignment. Local variables could also be declared to hold the intermediate objects. That is how to add elements to the varray. Next, the need is to access the values within an element in the varray using the code. Second instance is where a nested object type table has been declared that has three columns of datatype number, varchar2, and another object, respectively. To retrieve an attribute of this object from a nested table in a row of the table is attended to. Here one work with nested tables instead of varrays. Everything applies to both types of collections. One drill all the way down to an attribute of the object within the nested table. Let's suppose that one wants to see the type of meal served for each row in the nested table.