版次注意事項


8.1 Chapter 3. Application Considerations

|8.1.1 Specifying the Isolation Level

|Within the section titled "Specifying the Isolation Level", add the |following paragraphs: | |

|In addition to setting the isolation level at the package-level when preparing |or binding an application, you can set an isolation level at the statement-level. |A statement-level isolation level is specified using the WITH-clause.

|The following SQL statements support statement-level isolation: |

|There are some conditions associated with the use of statement-level isolation: |

|8.1.2 Adjusting the Optimization Class

|Within the section titled "Adjusting the Optimization Class", replace |the current level 2 information with the following: |

|2 -
|This class directs the optimizer to use a degree of optimization which |significantly improves upon that of class 1, while keeping the compilation |cost significantly lower than classes 3 and above for complex queries. In |particular: |

|Optimization class 2 is quite similar to class 5 except that it uses |Greedy join enumeration rather than Dynamic Programming. This class has the |most optimization of all the optimization classes that use the Greedy join |enumeration algorithm, which considers fewer alternatives for complex queries, |and therefore consumes less compilation time than classes 3 and above. It |is therefore recommended for very complex queries in a decision support or |online analytic processing (OLAP) environment. In such cases, there is a good |chance the same query is executed infrequently, so that its access plan is |unlikely to remain in the cache until the next occurrence of the query. |

|8.1.3 Dynamic Compound Statements

| |

|This new section should be added after the section titled "Compound SQL":

|A dynamic compound statement groups other SQL statements together into |an executable block. Within the dynamic compound statement you can declare |SQL variables, declare conditions associated with SQLSTATEs, and have one |or more SQL procedural statements. If an error occurs in the dynamic compound |statement, all prior SQL statements are rolled back and the remaining SQL |statements in the dynamic compound statement are not processed.

|The dynamic compound statement can be embedded in a trigger, SQL function, |SQL method, or issued through the use of dynamic SQL statements. This executable |statement can be dynamically prepared. No privileges are required to invoke |the statement but the authorization ID associated with the statement must |have the necessary privileges to invoke the embedded SQL statements within |the compound statement.

|Variables are present in the sub-statements in the variable declaration. |Conditions are present in the sub-statements based on the SQLSTATE values |of the condition declaration. Dynamic compound statements are compiled by |DB2 as a single statement. This statement can be used effectively for short |scripts involving little control flow logic but significant data flow. For |larger constructs with nested complex control flow, you should consider using |SQL procedures.

|There are several control flow logic statements that can be used within |the dynamic compound statement. These include: the FOR statement, the |IF statement, the ITERATE statement, and the WHILE statement. Details about |these statements, and the other supported statements, are found in the SQL Reference.


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]