In dynamic SQL, you do not write SQL source statements into the application program. Instead, you use variables in the host language to contain the SQL source. The SQL statements are then dynamically prepared and executed within the program as it runs and can change one or more times during the program's execution. This means you do not need to have complete knowledge of a dynamic SQL statement's full format at the time you write the program.
For example, if your program needs to allow for a large variety of selection criteria, with static SQL a small set of criteria can be used to select a table's rows while the rest of the criteria are compared against the return rows, but with dynamic SQL an SQL WHERE clause can be generated to drive the program and match the criteria exactly. (A WHERE clause produces an intermediate result table by applying a search condition to each row of a table R, the result of a FROM clause. The result table contains the rows of R for which the search condition is true. See the description in Subselect.
|
Copyright © 2014 CA.
All rights reserved.
|
|