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 |
|---|---|---|
|
|
|
Object ID. |
|
|
|
Number of columns. |
|
|
|
Column list. |
|
|
Boolean |
Is the table typed? |
|
|
Boolean |
Is the table temporary? |
|
|
|
Duration - can be session, transaction, or null. |
|
|
|
Data block address of the segment header. |
|
|
|
Tablespace in which the table resides. |
|
|
Boolean |
Is the table clustered? |
|
|
Boolean |
Is the table partitioned? |
|
|
Boolean |
Is the table index-only? |
See Also:
"Type (OraMetaData) Property"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.
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"
See Also: