Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
The following example creates an ADDRESS object type having street, city, state and zip as its attributes and a PERSON table having an ADDRESS object type column. It also inserts data using the ExecuteSQL method of OraDatabase object.
set OO4OSession = CreateObject("OracleInProcServer.XOraSession")
set hrDb = OO4OSession.OpenDatabase("ExampleDb", "scott/tiger", 0)
HRDb.ExecuteSQL("create type ADDRESS as object ( street
VARCHAR2(200), city varchar2(20), state CHAR(2),
zip varchar2(10) )")
HRDb.ExecuteSQL("create table person (name varchar2(20), age number,
addr ADDRESS) ")
HRDb.ExecuteSQL("insert into person values('nasser',40,
address('Wine Blvd', 'Pleasanton', 'CA', '94065'))")
HRDb.ExecuteSQL("insert into person values('Maha', 25,
address('Continental Way', 'Belmont',
'CA', '94002'))")
HRDb.ExecuteSQL("insert into person values('chris',30, address('First
Street', 'San Francisco', 'CA' ,'94123'))")
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|