Use the OPEN
statement to open a cursor. The syntax is:
is one of the following:
or host_variable [ [ INDICATOR ] indicator_variable, … ]
is an integer value or a host variable that contains an integer value specifying the number of rows to fetch. If you omit the FOR
clause, the statement is executed once for each member of the array.
is the name of the cursor being opened.
is either DESCRIPTOR SQLDA_descriptor
or a comma-separated list of host variables (and optional indicator variables) that initialize the cursor. If specifying an SQLDA_descriptor
, the descriptor must be initialized with a DESCRIBE
The OPEN statement initializes a cursor using the values provided in parameters. Once initialized, the cursor result set will remain unchanged unless the cursor is closed and re-opened. A cursor is automatically closed when an application terminates.
The following example declares a cursor named employees, that queries the emp table,
returning the employee number, name, salary and commission of an employee whose name matches a user-supplied value (stored in the host variable, :emp_name