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






Nested type Column

    

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>

   
    
    
    
  








Related examples in the same category

1.The Object Type Column Objects
2.Format column in the object
3.Alter a table with user-defined object to upgrade including data
4.use user-defined type as the column type
5.Query column with user-defined type
6.Check object table column type
7.Use varray in a table
8.This script demonstrates column objects.
9.Reference nested data type in select statement
10.Reference type column