|Oracle9i Application Developer's Guide - Large Objects (LOBs)
Release 1 (9.0.1)
Part Number A88879-01
External LOBs (BFILEs), 8 of 41
"Use Case Model: External LOBs (BFILEs)" for all basic operations of External LOBs (BFILES).
This procedure describes how to create a table of an object type with a BFILE attribute.
As shown in the diagram, you must create the object type that contains the
BFILE attributes before you can proceed to create a table that makes use of that object type.
Use the following syntax references:
NCLOBs cannot be attributes of an object type.
Our example application contains examples of two different ways in which object types can contain
Multimedia_tabcontains a column
Voiced_refthat references row objects in the table
VoiceOver_tabwhich is based on the type
Voiced_typ. This type contains two kinds of
CLOBto store the script that's read by the actor, and a
BFILEto hold the audio recording.
Map_objthat contains column objects of the type Map_typ. This type utilizes the
BFILEdatatype for storing aerial pictures of the region.
The following example is provided in SQL and applies to all programmatic environments:
/* 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 ); /* 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 Map_tab of MapLib_typ;