Oracle Objects for OLE Release 9.2 Part Number A95895-01 |
|
An OraObject object can be retrieved using OO4O in the following ways:
Using a Dynaset Object
If a table contains an object type column and a dynaset's query selects against that column, then the Value property of OraField object returns an OraObject.
The following code selects an ADDRESS column from the person table and then an 'Address' object is retrieved from the OraField object
set OO4OSession = CreateObject("OracleInProcServer.XOraSession")
set hrDb = OO4OSession.OpenDatabase("ExampleDb", "scott/tiger", 0)
set Person = hrDb.CreateDynaset("select * from person", 0&)
set Address = Person.Fields("Addr").Value
Using a Parameter Object
If a SQL statement or PL/SQL block has a bind variable of object type, you create a OraParameter object using the OraParameters Add method. The Value property of the OraParameter object for that bind variable returns an OraObject.
The following example uses an object datatype as a bind variable in a PLSQL anonymous block. This block selects an object column from the database.
set OO4OSession = CreateObject("OracleInProcServer.XOraSession")
set hrDb = OO4OSession.OpenDatabase("ExampleDb", "scott/tiger", 0)
hrDb.Parameters.Add "ADDRESS", Null, ORAPARM_OUTPUT, ORATYPE_OBJECT,
"ADDRESS"
'execute the sql statement which selects Address from the person_tab
hrDb.ExecuteSQL ("BEGIN select Addr into :ADDRESS from person where
age = 40; end;")
'retrieve Address object from the OraParameter
set address = hrDb.Parameters("ADDRESS").Value
|
Copyright © 1994, 2002 Oracle Corporation. All Rights Reserved. |
|