The SQL statement associated with an EGL statement can be
specified statically, with every detail in place at generation time. When
dynamic SQL is in effect, however, the SQL statement is built at run time,
each time that the EGL statement is invoked.
Use of dynamic SQL decreases the speed of runtime processing, but lets
you vary a database operation in response to a runtime value:
- For a database query, you may want to vary the selection criteria, how
data is aggregated, or the order in which rows are returned; those details
are controlled by the WHERE, HAVING, GROUP BY, and ORDER BY clauses. In this
case, you can use the prepare statement.
- For many kinds of operations, you may want a runtime value to determine
which table to access. You can accomplish dynamic specification of a table
in either of two ways:
- Use the prepare statement; or
- Use an SQL record and specify a value for the property tableNameVariables,
as described in SQL record part in EGL source format.