Chapter 11. Records and Collections
Records and collections are examples of composite data structures , which means that they are composed of more than one element or component, each with its own value. Records in PL/SQL programs are very similar in concept and structure to the rows of a database table. The record as a whole does not have a value of its own; instead, each individual component or field has a value, and the record gives you a way to store and access these values as a group. Records can greatly simplify your life as a programmer, allowing you to write and manage your code more efficiently by shifting from field-level declarations and manipulation to record-level operations.
A collection is a data structure that acts like a list or single-dimensional array. Collections are, in fact, the closest you can get to traditional arrays in the PL/SQL language. You can use collections to manage lists of information in your programs. This chapter will help you decide which of the three different types of collections (associative array, nested table, or VARRAY) best fit your program requirements, and will show you how to define and manipulate those structures.
First, let’s get to know records. They are simpler, and are often used within collections.
Records in PL/SQL
A record is similar in structure to a row in a database table. Each row in a table has one or more columns of various datatypes. A record is composed of one or more fields. There are three different ways to define ...
Get Oracle PL/SQL Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.