Opens a cursor.
The cursor is opened and references a set of rows in accordance with the definition of the cursor. The result-set is defined when the OPEN statement is executed, any inserts, updates or deletes occurring after the open will not be reflected in the result-set. The cursor is placed 'before' the first row in the addressed set.
The descriptor-name is identified by a host variable or a literal.
See ALLOCATE CURSOR for a description of extended cursors.
If the cursor is declared for a dynamically prepared SELECT statement, the source form of which contains parameter markers, the OPEN statement must include a USING clause.
The first variable in the variable list or referenced in the descriptor area takes the place of the first parameter marker, the second variable takes the place of the second marker, and so on.
The number of variables provided in the USING clause must be equal to the number of parameter markers in the source statement, and the data types of the variables must be assignment-compatible with their usage in the source statement. See the Mimer SQL Programmer's Manual, chapter 11, Dynamic SQL, for a more detailed description of the use of dynamically prepared statements.
If the cursor is already in the open state and the cursor has been declared as REOPENABLE, the previous state is saved on a cursor stack, and is recalled when the newly opened cursor is closed, see CLOSE. In this context, the state of a cursor includes both the set of rows addressed by the cursor and the position of the cursor within the set.
Cursors not declared as REOPENABLE may not be opened more than once in succession, unless it is closed by one of the statements COMMIT, ROLLBACK or CLOSE.
SELECT access is required to the table(s) or view(s) addressed by the cursor.
EXECUTE access is required to the result-set procedure addressed by the cursor.
In a procedural usage context, extended-cursor-name cannot be used to identify the cursor and neither of the USING options may be used.
A cursor must be declared with a DECLARE CURSOR statement or allocated with an ALLOCATE CURSOR statement before it may be opened.
All access rights that the current ident holds to the table(s) or view(s) addressed by the cursor are checked when the cursor is opened.
If SELECT access is lacking, the OPEN statement will fail.
If UPDATE or DELETE access is lacking, the cursor may be opened but any corresponding UPDATE CURRENT or DELETE CURRENT statements will fail.
Only cursors declared for dynamically prepared statements may be opened with a USING clause.
ExampleDECLARE c_1 CURSOR FOR SELECT product, producer, format, extract_date(release_date), price, item_id FROM product_details ... ... OPEN c_1;
For more information, see the Mimer SQL Programmer's Manual, chapter 12, Using Cursors.
YES Fully compliant.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40