The Data abstraction extracts the important properties of data while ignoring the not necessary details. Once you design a data structure, you can fail to remember the details and focus on designing algorithms that manipulate the data structure.
The collection types TABLE and VARRAY permit you to declare nested tables and variable-size arrays (varrays in short). A collection is an ordered group of elements, all of the similar type. Every element has a unique subscript that determines its place in the collection.
To reference an element, use the standard subscripting syntax. For e.g., the following call references the 5th element in the nested table returned by the function new_hires:
TYPE Staff IS TABLE OF Employee;
FUNCTION new_hires (hiredate DATE) RETURN Staff IS
BEGIN ... END;
staffer := new_hires('10-NOV-98')(5);
The Collections work like an array found in most third-generation programming languages. The collections can also be passed as parameters. And hence, you can use them to move columns of data into and out of database tables or between the client-side applications and stored subprograms.
You can use the %ROWTYPE attribute to declare a record that shows a row in a table or a row fetched from a cursor. Although, with a user-defined record, you can declare fields of your own. The Records contain exclusively named fields that can have different datatypes. Assume that you have different data about an employee like name, salary, & hire date. These items are not similar in type but logically related. Records containing a field for each item treat the data as a logical unit. Consider the example shown below:
TYPE TimeRec IS RECORD (hours SMALLINT, minutes SMALLINT);
TYPE MeetingTyp IS RECORD
duration TimeRec, -- nested record
Remember that you can nest the records. That is, the record can be the component of another record.