Lab 19.2 Nested Records

Lab Objective

After this Lab, you will be able to:

Use Nested Records

As mentioned in the introduction to this chapter, PL/SQL allows you to define nested records. These are records that contain other records and collections. The record that contains a nested record or collection is called an enclosing record.

Consider the following code fragment.

FOR EXAMPLE

DECLARE 
   TYPE name_type IS RECORD 
      (first_name VARCHAR2(15), 
       last_name VARCHAR2(30)); 

   TYPE person_type IS 
      (name name_type, 
       street VARCHAR2(50), 
       city VARCHAR2(25), 
       state VARCHAR2(2), 
       zip VARCHAR2(5)); 

   person_rec person_type; 

This code fragment contains two user-defined record types. The second user-defined record type, person_type, is a nested record type because ...

Get Oracle® PL/SQL® Interactive Workbook, Second 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.