Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E12245-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Trim (OraCollection) Method

Applies To

OraCollection Object

Description

Trims a given number of elements from the end of the collection.

Usage

OraCollection.Trim size

Arguments

The arguments for the method are:

Arguments Description
[in] size An Integer specifying the number of elements to trim.

Remarks

The elements are removed from the end of the collection. An error is returned if the size is greater than the current size of the collection.

Examples

The following example illustrates the Trim method. Before running the sample code, make sure that you have the necessary data types and tables in the database. See "Schema Objects Used in OraCollection Examples" .

Example: Trim Method for the OraCollection Object

Dim OraSession as OraSession
Dim OraDatabase as OraDatabase
Dim OraDynaset as OraDynaset
Dim EnameList as OraCollection
 
'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&)
 
'create a dynaset object from department
set OraDynaset = OraDatabase.CreateDynaset("select * from department", 0&)
 
'retrieve a Enames column from Department. 
'Here Value property of OraField object returns EnameList OraCollection
set EnameList = OraDynaset.Fields("Enames").Value
 
'display the size of the collection
msgbox  EnameList.Size
 
'Trim the EnameList collection by one. Before that row level
 'lock should be obtained
 
OraDynaset.Edit
EnameList.Trim 1
OraDynaset.Update
 
'display the new size of the collection
msgbox EnameList.Size