![]() |
Creating Nested Tables![]() ![]() ![]() ![]() ![]()
In this example, you'll see how to nest one table inside another using an object type. When you nest a child table inside its parent table, Oracle automatically manages the built-in relationships among each row of the parent table and the associated nested table rows.
Nested tables are appropriate for master-detail relationships in which detailrows store unique information. For example, consider the typical ORDERS and ITEMS tables in a relational order-entry database. Each line item is a unique collection of data that corresponds to a particular order. This is the kind of masterdetail relationship that is the perfect candidate for a nested table. The following example creates a simplified ITEM-TYPE ( no reference to the part ID is included) and corresponding ITEM-LIST-TYPE that you can then use to nest a typical ITEMS table inside a typical ORDERS table.
CREATE OR REPLACE TYPE sales.item-type AS OBJECT( As you might expect, manipulating nested tables requires that you use some special DML syntax. For example, an application can insert a new order and corresponding items into the new ORDERS table using a single INSERT statement with constructors to insert ITEMS into the nested table.
INSERT INTO sales.orders VALUES(
|
|
Domain NamesSQL Database Management Systems Relational Database Management System Properties of RDBMS Client Server Computing Oracle Relational Database Database Structure and Space Management SQL Data Types How to Use Data Types? What is Operators and Conditions Character OperatorsOperator Precedence Data Retrieval Using SQL Plus SQL Data Definitions Data Retrieval Using Select SQL Operator Precedence Selecting Rows and Columns The Group by Clause
Having Clause Union, Union all, Intersact and Minus Commands Playing with Numbers Date Functions Example of Date Arithmetic Working with Null Values
Joining Tables and Subqueries Views Synonyms Indexes Clusters Sequences Formatting Query Results with SQL Plus Data Integrity The Optimizer How Oracle Optimizes SQL Statements Evaluating Expression and ConditionsOptimization Hints PL-SQL PL-SQL Architecture Error Reporting Functions Character Functions Composite Data Types PL-SQL Structures How to use PL-SQL Structures Normalization Operator Precedence Cursor Error Handling Database Triggers Types of Triggers Locking Sub Programs Packages New and Improved Data Types Improved Select Statement Advanced Quering Improved Scalability Improved Performance Via Partitioning Object Relational Features Heterogeneous Data Access Improved Security Administration New Data Types Improved Select Statement Changes to the Select Statement Improved Scalability Data Partitioning Oriented Toward Objects Character Functions Creating Object Types Created Nested Tables Oracle8 and Distributed Database Oracle8 Database Management and Security Distributed Database Invoking Export Invoking ImportWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |