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

Creating a VARRAY Collection Type

The following example code creates a VARRAY collection type ENAMELIST and department table having ENAMELIST collection type column.

set OO4OSession = CreateObject("OracleInProcServer.XOraSession")

set hrDb = OO4OSession.OpenDatabase("Exampledb",

"scott/tiger", 0)

hrDb.ExecuteSQL("CREATE TYPE ENAMELIST AS VARRAY(20) OF

VARCHAR2(30)")

hrDb.ExecuteSQL("CREATE TABLE department (dept_id NUMBER(2),name

VARCHAR2(15),ENAMES ENAMELIST)")

The following script inserts some collection data into department table:

hrDb.ExecuteSQL("INSERT INTO department VALUES(10, 'ACCOUNTING',

ENAMELIST('KING','CLARK','MILLER') )")

hrDb.ExecuteSQL("INSERT INTO department VALUES(20, 'RESEARCH',

ENAMELIST('JONES','SCOTT','ADAMS','SMITH','FORD') )")

hrDb.ExecuteSQL("INSERT INTO department VALUES(30, 'SALES',

ENAMELIST('BLAKE','MARTIN','ALLEN','TURNER','JAMES') )")