Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
|
An OParamArray an object enables you to place array bind variables within a SQL or PL/SQL statement. The simplest use would be in the SQL statement that executes an insert statement:
insert into part_nos(partno) values(:PARTNO)
In this example :partno is a parameter. (In SQL syntax, a parameter name is prefixed with a colon.) When the SQL statement is executed, the current value of the parameter is substituted for :pvalue. Such a parameter can be used wherever a literal value can be placed: values within update and insert statements and values that are part of where clauses.
Parameters are also used to represent arguments in calls to stored procedures. A stored procedure is a PL/SQL program that is stored in the Oracle database. Parameters can be used both as input and as output variables. See the example in ExecuteSQL for a sample of calling a stored procedure.
Parameters are managed as OParameter or OParamArray objects. OParameter/OParamArray objects are managed by way of an OParameterCollection that exists for every database object. You attach parameter objects to databases by using the Add method of the OParameterCollection class. OParamArray is a subclass of OOracleObject.
The primary benefit of using OParamArray is efficiency and reduction of network traffic. For example using OParamArray objects, you can insert multiple rows at a time using a single "insert" statement.
Parameters are attached to an ODatabase object. By default OParameters are auto-enabled. This means that they can bind to any ODynasets and OSqlStmts. By using the AutoEnable method, you can turn this default behavior off and on. This can be useful if there are a large number of OParamArray objects, which
could result in many parameters being unnecessarily bound. Such a condition does not cause errors, but might be inefficient.
See Also
Construction and destruction:
Attributes:
Operations:
AutoEnable Clear Close |
GetArraySize GetValue SetValue |