Skip Headers

Oracle® Objects for OLE Developer's Guide
10g Release 1 (10.1)

Part Number B10118-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Example: Describing Unknown Schema Objects

See OraMetaData Schema Definitions.

Sub RecursiveDescribe(name$, xMD As OraMetaData)

Dim xMDAttr As OraMDAttribute

For I = 0 To xMD.Count - 1

Set xMDAttr = xMD.Attribute(I)

' If an attribute can be described further, describe it,

' otherwise display its attribute name & value

If (xMDAttr.IsMDObject) Then

RecursiveDescribe xMDAttr.name, xMDAttr.Value

Else

MsgBox name & "->" & xMDAttr.name & " = " & xMDAttr.Value

End If

Next I

End Sub

Sub Main()

'This example displays all the attributes of any schema object given

Dim OraSession As OraSession

Dim OraDatabase As OraDatabase

Dim OraDynaset As OraDynaset

Dim xMD As OraMetaData

Dim x As String

'Create the OraSession Object.

Set OraSession = CreateObject("OracleInProcServer.XOraSession")

'Create the OraDatabase Object by opening a connection to Oracle.

Set OraDatabase = OraSession.OpenDatabase("ExampleDB", "scott/tiger", 0&)

' x is any database object, here the EMP table is used as an example

x = "EMP"

Set xMD = OraDatabase.Describe(x)

MsgBox x & " is of the type " & xMD.Type

RecursiveDescribe x, xMD

End Sub