19.06.2013 Views

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

DB2 UDB for z/OS Version 8 Performance Topics - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If you specify this option, the result table of the cursor is dynamic. It means that the size of<br />

the result table is not fixed and it may change depending on the changes made against<br />

rows in the underlying table after the cursor is opened. All inserts, updates, and deletes by<br />

the same application processes through the cursor are immediately visible. Also all<br />

positioned updates and deletes are immediately visible even be<strong>for</strong>e commit. And inserts<br />

and updates and deletes by other applications are visible once committed. No temporary<br />

result table is created <strong>for</strong> SENSITIVE DYNAMIC, since the FETCH statements are<br />

executed against the base table.<br />

► ASENSITIVE SCROLLABLE<br />

You can use this option, when you let <strong>DB2</strong> determine the sensitivity of the cursor. <strong>DB2</strong><br />

determines whether the cursor behaves as SENSITIVE DYNAMIC SCROLLABLE or<br />

INSENSITIVE (STATIC) SCROLLABLE depending on the update ability of the associated<br />

SELECT statement. ASENSITIVE CURSORS may then require TEMP database since<br />

they can resolve to INSENSITIVE cursors, depending on the SELECT statement.<br />

– The cursor behaves as an INSENSITIVE SCROLLABLE cursor, when the SELECT<br />

statement is read-only and does not allow the cursor to be sensitive. In these cases,<br />

access to the declared temporary table may be necessary.<br />

– The cursor provides maximum sensitivity, which is SENSITIVE DYNAMIC<br />

SCROLLABLE, when the cursor is not read-only.<br />

It is suitable <strong>for</strong> client applications that do not care about whether or not the server<br />

supports sensitivity.<br />

Note: There is no DYNAMIC option <strong>for</strong> INSENSITIVE. The syntax is SENSITIVE<br />

DYNAMIC SCROLLABLE cursor (the query cannot be read-only) or INSENSITIVE<br />

SCROLLABLE cursor (the query can be anything, but a temp table may be required <strong>for</strong><br />

materialization).<br />

The current conditions <strong>for</strong> read-only cursors are listed under Declare Cursor in Chapter 5<br />

of <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 SQL Reference, SC18-7426-01. The READ ONLY and<br />

FETCH ONLY clauses by themselves do not require a temporary data base.<br />

FETCH statement<br />

There is no new option in V8 to use dynamic scrollable cursors. All the positioning keywords<br />

<strong>for</strong> fetch (NEXT, PRIOR, FIRST, LAST, CURRENT, BEFORE, AFTER, ABSOLUTE, and<br />

RELATIVE) that were introduced in <strong>DB2</strong> V7 to support static scrollable cursors are equally<br />

relevant <strong>for</strong> dynamic scrollable cursors. However, there are some restrictions and<br />

considerations about the FETCH statement. Figure 3-45 shows the FETCH syntax.<br />

Chapter 3. SQL per<strong>for</strong>mance 95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!