OraMetaData Object

Description

The OraMetaData object is returned by invoking the Describe method of the OraDatabase interface. The Describe method takes the name of a schema object, such as the emp table, and returns an OraMetaData object. The OraMetaData object provides methods for dynamically navigating and accessing all the attributes (OraMDAttribute collection) of a schema object described.

An OraMetaData object is a collection of OraMDAttribute objects that represent the description information about a particular schema object in the database. The following table is an example of attributes for a OraMetaData object of type table (ORAMD_TABLE).

Table 9-2 list the ORAMD_TABLE attributes.

Table 9-2 ORAMD_TABLE Attributes

Attribute Name Value Type Description

ObjectID

Integer

Object ID.

NumCols

Integer

Number of columns.

ColumnList

OraMetaData

Column list.

IsTyped

Boolean

Is the table typed?

IsTemporary

Boolean

Is the table temporary?

Duration

String

Duration - can be session, transaction, or null.

DBA

Integer

Data block address of the segment header.

TableSpace

Integer

Tablespace in which the table resides.

IsClustered

Boolean

Is the table clustered?

IsPartitioned

Boolean

Is the table partitioned?

IsIndexOnly

Boolean

Is the table index-only?


Remarks

The OraMetaData object can be visualized as a table with three columns:

  • Metadata attribute name

  • Metadata attribute value

  • Flag specifying whether the Value is another OraMetaData object

The OraMDAttribute objects contained in the OraMetaData object can be accessed by creating a subscript that uses ordinal integers or by using the name of the property. Referencing a subscript that is not in the collection (0 to Count-1) results in the return of a NULL OraMDAttribute object.

Examples

See "Schema Objects Used in OraMetaData Examples" for OraMetaData schema definitions used in these examples.

The following Visual Basic example illustrates a simple use of this facility. It retrieves and displays several attributes of the emp table.

Set empMD = OraDatabase.Describe("emp") 
 
'Display the name of the Tablespace 
msgbox empMD("tablespace") 
 
'Display name, data type, and size of each column in the emp table. 
Set empColumnsMD = empMD("Columns") 
for I = 1 to empColumns.Count 
   Set ColumnMD = empColumnsMD(I) 
   MsgBox ColumnMD("Name") & ColumnMD("Data Type") & ColumnMD("Length")
Next I

Example: Describing a User-Defined Type

See "Example: Describing a User-Defined Type"

Example: Describing Unknown Schema Objects

See "Example: Describing Unknown Schema Objects"