Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-01 |
|
The OraMetaData interface provides access to the schema information of database objects. It 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.
The following VB script illustrates a simple use of the OraMetaData interface. The sample retrieves and displays several attributes of the emp table.
Dim empMD as OraMetaData
set OO4OSession = CreateObject("OracleInProcServer.XOraSession")
set empDb = OO4OSession.OpenDatabase("ExampleDb", "scott/tiger", 0)
Add EMPNO as an Input parameter and set its initial value.
Set empMd = empDb.Describe("emp")
Get the column attribute collections.
Set empColumnsMd = empMd("ColumnList").Value
Display name, data type, and size of each column in the emp table.
For I = 0 To empColumnsMd.Count - 1
Set ColumnMd = empColumnsMd(I).Value
MsgBox ColumnMd("DataType").Value
MsgBox ColumnMd("Name").Value
Next I