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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

While there is no optimistic locking with the dynamic scrollable cursor model, it is also<br />

recommended that CS be used to achieve maximum concurrency. Since dynamic scrollable<br />

cursors are most useful <strong>for</strong> applications that want to see updated rows as well as newly<br />

inserted rows, specifying an isolation level of RS or RR restricts updates to the table by other<br />

users.<br />

3.12.2 Dynamic scrollable cursor description<br />

Dynamic scrollable cursors allow visibility of inserts as well as updates done by you or other<br />

users, while static scrollable cursors do not have a visibility to inserts. The differences of<br />

dynamic scrollable cursor compared to static scrollable cursor are:<br />

► Accesses the base tables directly<br />

► Inserts done into the base tables are visible<br />

► New options of DECLARE CURSOR statement:<br />

– DECLARE CURSOR ASENSITIVE<br />

– DECLARE CURSOR SENSITIVE DYNAMIC<br />

Dynamic scrollable cursors can be used with row-level or rowset-level operations, so DDF<br />

applications should use multi-row FETCH and positioned UPDATE/DELETE <strong>for</strong> multi-row<br />

FETCH.<br />

Sensitivity options <strong>for</strong> dynamic scrollable cursor<br />

In this section we show the syntax of the DECLARE CURSOR and FETCH statements<br />

associated with the dynamic scrollable cursors.<br />

DECLARE CURSOR statement<br />

There are some new options in V8 in the DECLARE CURSOR statement to support dynamic<br />

scrollable cursors. Figure 3-44 shows the syntax of the DECLARE CURSOR.<br />

DECLARE cursor-nam e<br />

Figure 3-44 DECLARE CURSOR syntax<br />

NO SCROLL is the default and indicates that the cursors are not scrollable. If you specify<br />

SCROLL, the cursors become scrollable. ASENSITIVE and SENSITIVE DYNAMIC are new<br />

options of scrollable cursors introduced in V8. INSENSITIVE and SENSITIVE STATIC are<br />

equivalent to static scrollable cursors in V7.<br />

The new two attributes of dynamic scrollable cursors determine the sensitivity of the cursors.<br />

► SENSITIVE DYNAMIC SCROLLABLE<br />

94 <strong>DB2</strong> <strong>UDB</strong> <strong>for</strong> z/<strong>OS</strong> <strong>Version</strong> 8 Per<strong>for</strong>mance <strong>Topics</strong><br />

DECLARE CURSOR<br />

NO SCROLL<br />

ASENSITIVE<br />

IN S E N S ITIV E<br />

SENSITIVE<br />

STATIC<br />

DYNAMIC<br />

SCROLL<br />

CURSOR FOR select-statement<br />

WITH HOLD<br />

WITH RETURN<br />

statement-name

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

Saved successfully!

Ooh no, something went wrong!