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

Accessing Collection Elements

Individual element values are accessed by using a subscript. For example, the Value returned by OraCollection for subscript 1 is the element value at index 1. The maximum value of the subscript is equal to total number of elements in the collection including deleted elements. The OraCollection subscript starts from 1.

The following example code retrieves the ENAMELIST collection instance and accesses its elements at the first and second index.

set OO4OSession = CreateObject("OracleInProcServer.XOraSession")

set hrDb = OO4OSession.OpenDatabase("ExampleDb", "scott/tiger", 0)

Set Dept = hrDb.CreateDynaset("select * from department", 0&)

Set EnameList = Dept.Fields("ENAMES").Value

msgbox EnameList(1)

msgbox EnameList(2)

This code displays all the element values of EnameList

For I = 1 to EnameList.Size

msgbox EnameList(I)

Next I