Besides improved query plans, the only user-visible changes are as follows:
If you are using showplan, the plan is no longer displayed at the declare cursor statement, but at the open statement.
The query is normalized at the declare cursor statement, so error messages about syntax errors, missing tables, and so forth, are reported at that time.
Some error messages do not appear until the query is compiled and optimized, including those for cursors that require unique indexes. If error messages result at cursor open time (such as the lack of a needed index), the cursor must be deallocated and redeclared. You cannot just correct the problem and reopen the cursor.
In pre-11.9.2 versions, changing isolation levels between cursor declare time and cursor open time generated an error message when the cursor was opened. In version 11.9.2, the following sequence of commands does not generate an error, and the cursor is compiled at transaction isolation level 0:
*start at isolation level 1 */ declare curs1 cursor for select t.title_id, au_lname from titles t , authors a, titleauthor ta where t.title_id = ta.title_id and a.au_id = ta.au_id go set transaction isolation level 0 go open curs1 go fetch curs1 go
Delayed optimization does not apply to cursors that are declared in a stored procedure (called server cursors). Server cursors are compiled and optimized when they are declared.