![]() |
Creating Object Types![]() ![]() ![]() ![]() ![]()
When you want to create a new object type, you can declare two separate parts-the type's specification and body :
Similar to PL/SQL packages, an object type's specification is the public interface that developers use to work with the type when building applications. To create an object type's specification, you use the SQL command CREATE TYPE. An object type's body is the private implementation of the type's methods; it's only necessary to create a body for an object type when the type's specification declares one or more methods. To create an object type's body, you use the SQL command CREATE TYPE BODY. Examples of Creating and Using Object Types The following examples demonstrate some common object types and how you might use them in your database designs. The examples illustrate the varying degrees to which you can use object types in an Oracle database-from augmenting a relational database design to building an object database. Creating Custom Datatypes with Object Types The most straightforward use of object types is for the creation of custom datatypes that you can then use to build relational database objects more easily. For example, the following statement creates a new ADDRESS-TYPE:
CREATE OR REPLACE TYPE pub.address-type AS OBJECT
Because the specification of the ADDRESS-TYPE does not include any method specifications, a body is not necessary for the type. When developers need to declare an address in a relational database table, they can use the ADDRESSTYPE and automatically comply with corporate guidelines.
CREATE TABLE sales.customers SELECT
id, last-name, first-name,
|
|
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. |