4.2. Object Columns and Object Tables
You can use object types to define columns in a table. Such columns are known as object columns because they contain objects rather than scalar values. You can also define tables so that each row in the table represents an instance of an object. Such tables are known as object tables. In this section, you will learn to create both object columns and object tables. You will learn how to add, retrieve, and modify rows containing object columns, and how to add, retrieve, and modify rows in object tables.
4.2.1. Object Columns
An object column is a column in a table that is defined using an object type. (Objects stored in an object column are sometimes referred to as column objects.) The following example creates a table named customers. It contains one object column named customer, which is defined using the t_customer object type:
CREATE TABLE customers ( customer t_customer );
The customer column in this table is used to store objects of the t_customer type. You can see the structure of the table from SQL*Plus by entering the command DESC customers. For example:
SQL> DESC customers; Name Null? Type ------------------ -------- ---------------------------- CUSTOMER T_CUSTOMER
Notice in this example that a single column of type t_customer appears as a column in the table structure.
4.2.2. Object Tables
An object table is a table in which each row contains one object of a given object type. Such objects are known as row objects. You create ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access