What is the difference between Collection and Records?
Collection | Record |
---|---|
The internal components always have the same data type, and are called elements | The internal components can have different data types, and are called fields |
You can access each element of a collection variable by its unique index | You can access each field of a record variable by its name |
Syntax: variable_name(index). | Syntax: variable_name.field_name |
To create a collection variable : define a collection type and then create a variable of that type or use %TYPE. | To create a record variable: define a RECORD type and then create a variable of that type or use %ROWTYPE or %TYPE. |
You can create a collection of records. | You can create a record that contains collections. |