Oracle9i Application Developer's Guide - Large Objects (LOBs)
Release 1 (9.0.1)

Part Number A88879-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Internal Persistent LOBs, 5 of 43


Creating a Table Containing an Object Type with a LOB Attribute

Figure 10-6 Use Case Diagram: Creating a Table Containing an Object Type with a LOB Attribute


Text description of adl10p43.gif follows This link takes you back to the Internal Persistent LOB main diagram This link takes you back to the Create a Table mother diagram
Text description of the illustration adl10p43.gif

See: Figure 10-1, "Use Case Model Diagram: Internal Persistent LOBs (part 1 of 2)", for all Internal Persistent LOB operations.:  

Purpose

This procedure describes how to create a table containing an object type with an LOB attribute.

Usage Notes

Not applicable.

Syntax

See the following specific reference for a detailed syntax description:

Scenario

As shown in the diagram Figure 10-6, you must create the object type that contains LOB attributes before you can proceed to create a table that makes use of that object type.

The example application illustrates two ways in which object types can contain LOBs:

Figure 10-7 VOICED_TYP As An Example of Creating a Type Containing a LOB

Text description of adl81036.gif follows
Text description of the illustration adl81036.gif
Examples

The example is provided in SQL and applies to all programmatic environments:

SQL: Creating a Table Containing an Object Type with a LOB Attribute

/* Create type Voiced_typ as a basis for tables that can contain recordings of 
   voice-over readings using SQL DDL: */
CREATE TYPE Voiced_typ AS OBJECT ( 
   Originator      VARCHAR2(30), 
   Script          CLOB, 
   Actor           VARCHAR2(30),  
   Take            NUMBER,
   Recording       BFILE 
);

/* Create table Voiceover_tab Using SQL DDL: */
CREATE TABLE Voiceover_tab of Voiced_typ (
Script DEFAULT EMPTY_CLOB(), 
   CONSTRAINT Take CHECK (Take IS NOT NULL),
   Recording DEFAULT NULL
);

Figure 10-8 MAP_TYP As An Example of Creating a Type Containing a LOB




Text description of adl81035.gif follows
Text description of the illustration adl81035.gif
/* Create Type Map_typ using SQL DDL as a basis for the table that will contain the column object: */ CREATE TYPE Map_typ AS OBJECT ( Region VARCHAR2(30), NW NUMBER, NE NUMBER, SW NUMBER, SE NUMBER, Drawing BLOB, Aerial BFILE ); /* Create support table MapLib_tab as an archive of maps using SQL DDL: */ CREATE TABLE MapLib_tab of Map_typ;

See Also:

Oracle9i SQL Reference for a complete specification of the syntax for using LOBs in DDL commands, CREATE TYPE and ALTER TYPE with BLOB, CLOB, and BFILE attributes.  


Note:

NCLOBs cannot be attributes of an object type. 



Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback