Comparing Dynamic SQL with Static SQL

Determining whether to use static or dynamic SQL for performance is usually of great interest to programmers. The answer, of course, is that it all depends on your situation. Refer to Table 9.6 to help you decide whether to use static or dynamic SQL. Certain considerations, such as security, might dictate static SQL, or your environment (such as whether you are using DB2 CLI or the CLP) might dictate dynamic SQL.

Consider the following recommendations on whether to choose static or dynamic SQL in a particular situation. In the following table, “Either” means that there is no advantage to either static or dynamic SQL. Note that these are general recommendations only. Your specific application, its intended ...

Get DB2® Universal Database™ v8 Application Development Certification Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.