Db2- What is an ambiguous cursor?

When DB2 does not know whether or not you will use the cursor for updating or deleting, it will prepare for a worst-case scenario (that you do perform an update). When DB2 is in doubt about this, the cursor is called ambiguous and the access path chosen by the optimizer will not necessarily be the best for the function being performed.

The way to avoid ambiguous cursors is to code a FOR UPDATE OF clause when the cursor will be used in an UPDATE WHERE CURRENT OF statement, or to code a FOR FETCH ONLY or FOR READ ONLY on the cursor when it is only going to be used to retrieve data.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.