Data Access Getting Started > Nested Tables > Setting Up the Database
 
Setting Up the Database
This tutorial uses a database schema with a single table called PRODUCT. Use your own database system tools to create the table, using the following SQL statements as a model. The statements are based on Oracle syntax.
*PARTS_T Type
CREATE TYPE PARTS_T AS OBJECT (
PARTNO INTEGER NOT NULL,
PARTNAME VARCHAR(20) NOT NULL)
*PARTS_TABLE_T Type
CREATE TYPE PARTS_TABLE_T AS TABLE OF PART_T
*PRODUCT Table
CREATE TABLE PRODUCT (
PRODNO INTEGER NOT NULL,
PRODNAME VARCHAR(50) NOT NULL,
PARTS PARTS_TABLE_T,
PRIMARY KEY (PRODNO))
The column PARTS in the PRODUCT table contains the nested tables.
*The PRODUCT table contains the following data:
PRODNO
PRODNAME
PARTS
 
 
PARTNO
PARTNAME
1
Dresser
1001
1002
Drawer
Handles
2
Showcase
2001
2002
Wood shelf
Glass shelf
3
Wardrobe
3001
3002
3003
1 meter shelf
Rod
Basket

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.