1 – cursor-name
Specifies the name of the cursor you want to open. Use a
parameter if the cursor referred to by the cursor name was
declared at run time with a dynamic DECLARE CURSOR statement.
Specify the parameter used for the cursor name in the extended
dynamic DECLARE CURSOR statement.
You can use a parameter to refer to the cursor name only when the
OPEN statement refers to an extended dynamic cursor.
2 – parameter
Specifies the name of the cursor you want to open. Use a
parameter if the cursor referred to by the cursor name was
declared at run time with a dynamic DECLARE CURSOR statement.
Specify the parameter used for the cursor name in the extended
dynamic DECLARE CURSOR statement.
You can use a parameter to refer to the cursor name only when the
OPEN statement refers to an extended dynamic cursor.
3 – USING
Syntax options:
USING parameter
USING qualified-parameter
USING DESCRIPTOR descriptor-name
Specifies in dynamic SQL parameters (host language variables in
a precompiled OPEN statement or formal parameters in an OPEN
statement that is part of an SQL module language procedure)
or qualified parameters (structures) whose values SQL uses to
replace parameter markers in a prepared SELECT statement named
in the cursor declaration. These parameters are not for use in
interactive SQL. SQL replaces the parameter markers with the
values of the host language variables when it evaluates the
SELECT statement of the cursor. See the Oracle Rdb SQL Reference
Manual for more information on the SQL module language and the
SQL precompiler, respectively.
You must specify the USING clause when both of the following
conditions exist:
o The declaration of the cursor you are opening specifies a
prepared SELECT statement name.
o The statement string for the prepared SELECT statement
includes parameter markers.
SQL does not allow the USING clause in an OPEN statement for a
cursor that is not based on a prepared SELECT statement. For
more information on parameter markers, see the PREPARE statement,
and the chapter on dynamic SQL in the Oracle Rdb Guide to SQL
Programming.
There are two ways to specify parameters in a USING clause:
o With a list of parameters. The number of parameters in the
list must be the same as the number of parameter markers in
the prepared SELECT statement. (If any of the parameters in
an OPEN statement is a host structure, SQL counts the number
of variables in that structure when it compares the number of
parameters in the USING clause with the number of parameter
markers in the prepared SELECT statement.)
o With the name of a descriptor that corresponds to an SQLDA.
Specify the name of the descriptor in the USING DESCRIPTOR
clause. If you use the INCLUDE statement to insert the SQLDA
into your program, the descriptor name is simply SQLDA.
The SQLDA is a collection of variables used only in dynamic
SQL. In an OPEN statement, the SQLDA points to a number
of host language variables with which SQL replaces the
parameter markers in a prepared SELECT statement. The number
of variables must match the number of parameter markers.
The data types of host language variables must be compatible with
the values of the corresponding column of the cursor row.