Type Inheritance : Type Inheritance « Object Oriented « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE Or Replace TYPE AddressType AS OBJECT (
  2    street VARCHAR2(15),
  3    city   VARCHAR2(15),
  4    state  CHAR(2),
  5    zip    VARCHAR2(5)
  6  )
  7  /

Type created.

SQL>
SQL> CREATE Or Replace TYPE PersonType AS OBJECT (
  2    id         NUMBER,
  3    first_name VARCHAR2(10),
  4    last_name  VARCHAR2(10),
  5    dob        DATE,
  6    phone      VARCHAR2(12),
  7    address    AddressType
  8  ) NOT FINAL;
  9  /

Type created.

SQL>
SQL> drop type persontype;

Type dropped.

SQL>
SQL> drop type addresstype;

Type dropped.

SQL>








32.5.Type Inheritance
32.5.1.Type Inheritance
32.5.2.The NOT FINAL clause indicates that object can be inherited from when defining another type.
32.5.3.NOT FINAL clause
32.5.4.Insert data into table with inheritecd columns
32.5.5.select from inherited object columns
32.5.6.NOT INSTANTIABLE Object Types
32.5.7.Query table with sub type column
32.5.8.Insert into table with sub type column