Nested type Column : Object Column « Object Oriented « Oracle PL/SQL Tutorial






SQL> create or replace type addressType as object
  2  (
  3       Street  VARCHAR2(50),
  4       City    VARCHAR2(25),
  5       State   CHAR(2),
  6       Zip     NUMBER
  7  );
  8  /
SQL> create or replace type personType as object
  2  (
  3      Name      VARCHAR2(25),
  4      Address   addressType
  5  );
  6  /
SQL> create table CUSTOMER
  2  (
  3   cid  NUMBER,
  4   Person       personType
  5  );
SQL>
SQL> insert into CUSTOMER values(444, personType('Name',addressType('1 RD', 'Van', 'MA', '10002')));
SQL>
SQL>
SQL> drop table customer;
SQL> drop type personType;
SQL> drop type addressType;
SQL>








32.7.Object Column
32.7.1.Using Object Types to Define Column Objects and Object Tables
32.7.2.You can use an object type to define an entire table, and the table is known as an object table.
32.7.3.The Object Type Column Objects
32.7.4.Loading the 'row object' Table
32.7.5.SELECT with a WHERE Clause
32.7.6.UPDATE Data in a Table of Row Objects
32.7.7.Using UPDATE with TYPEed Columns
32.7.8.Query a table with user-defined column type
32.7.9.Use * to reference all columns from a table
32.7.10.Use 'table of custom type' as table column type
32.7.11.Nested varray and table collection column
32.7.12.Create type and use it as table column
32.7.13.Nested type Column
32.7.14.Create a new type and add it to a table