Oracle® Objects for OLE Developer's Guide 10g Release 1 (10.1) Part Number B10118-01 |
|
OO4O supports an array interface to an Oracle database through OraParamArray object. The array interface enables the transfer of bulk of data in single network trip. This is especially helpful while processing a PL/SQL or SQL statement through the ExecuteSQL or CreateSQL method. For example, in order to insert 100 rows into remote database without array processing, ExecuteSQL/CreateSQL must be called for 100 times, which in turn make 100 network trips. For example:
For I = 1 to 100
OraParameter("EMPNO").Value = xxxx
OraParameter("ENAME").Value = 'yyyy'
OraParameter("DEPTNO").Value = zz
OraDatabase.ExecuteSql("insert into emp values
(:EMPNO,:ENAME,:DEPTNO)");
Next I
The following example make use of arrays and do only one network trip.
' :ENAMEARR,:EMPNOARR,:DEPTNOARR are parameter arrays
For I = 1 to 100
OraParameter("EMPNOARR").Put_Value xxxx, I
OraParameter("ENAMEARR").Put_Value 'yyyy' ,I
OraParameter("DEPTNOARR").Put_Value zz, I
Next I
'Now call the ExecuteSQL only once
OraDatabase.ExecuteSql("insert into emp
values(:EMPNOARR, :ENAMEARR, :DEPTNOARR)");
For more information on using arrays , see the OraParamArray object.