Nested varray and table collection column : Object Column « Object Oriented « Oracle PL/SQL Tutorial






SQL>
SQL> create or replace type myScalarType as object( x int, y date, z varchar2(25) );
  2  /

Type created.

SQL>
SQL> create or replace type myArrayType as varray(25) of myScalarType
  2  /

Type created.

SQL>
SQL> create or replace type myTableType as table of myScalarType
  2  /

Type created.

SQL>
SQL> create table t(a int,b myArrayType,c myTableType)nested table c store as c_tbl
  2  /

Table created.

SQL>
SQL> insert into t values ( 1,
  2                  myArrayType( myScalarType( 2, sysdate, 'hello' ) ),
  3                  myTableType( myScalarType( 3, sysdate, 'GoodBye' ) )
  4                                   );

1 row created.

SQL> drop table t;

Table dropped.

SQL> drop type myTableType;

Type dropped.

SQL> drop type myArrayType;

Type dropped.

SQL> drop type myScalarType;

Type dropped.








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