Database Reference
In-Depth Information
Figure 18.5
CREATE TABLE
Syntax for an
Object Table.
Let's run through some simple examples. We can create a table similar to
an existing table as an object table. First, let's create a new type duplicating
the structure of the MUSIC schema INSTRUMENT table.
CREATE OR REPLACE TYPE INSTRUMENTTYPE AS OBJECT(
INSTRUMENT_ID NUMBER
, SECTION_ID NUMBER
, NAME VARCHAR2(32));
/
Second, create a table using the new type.
CREATE TABLE INSTRUMENTS OF INSTRUMENTTYPE;
Let's try something else. First, drop the INSTRUMENT table and then
re-create it, but this time using a specified index for a system-generated
object identifier (OID), which is presumed to be unique throughout an
entire database. The index is shown in Figure 18.6. The query used exam-
ines all of a current user's indexes and is included in Appendix B.
DROP TABLE INSTRUMENTS;
CREATE TABLE INSTRUMENTS OF INSTRUMENTTYPE
OBJECT IDENTIFIER IS SYSTEM GENERATED
OIDINDEX OIDX_INSTRUMENTS;
 
Search WWH ::




Custom Search