O'Reilly logo

Oracle PL/SQL Programming, Third Edition by Bill Pribyl, Steven Feuerstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required