Comparing Static and Dynamic Statements [ ALLBASE/SQL Release F.0 Application Programming Bulletin for MPE/iX ] MPE/iX 5.0 Documentation
ALLBASE/SQL Release F.0 Application Programming Bulletin for MPE/iX
Comparing Static and Dynamic Statements
An ALLBASE/SQL application can contain both static and dynamic SQL
statements. A static statement involves the preparation and storing of a
section at preprocessing time and the execution of that stored section at
run time. A dynamic statement involves the preparation and execution of
a section at runtime. Some statements do not require a section, and they
are also classified as dynamic.
Each type of statement has advantages and disadvantages as listed below:
* A static statement performs more efficiently than the equivalent
dynamic statement.
* In order to execute a static statement, a program module
(containing a stored section for the statement) must be installed
in each DBEnvironment in which the statement is to run. A
dynamically preprocessed statement is portable and can be run in
any DBEnvironment without installing a program module.
* Dynamic statements may be more complex to code than are static
statements.
Note that all objects referenced by a statement, whether it is static or
dynamic, must be present in the DBEnvironment in which the application is
running.
The following are dynamic statements:
* PREPARE
* DECLARE CURSOR when used with a CommandName
* DESCRIBE
* EXECUTE
* EXECUTE IMMEDIATE
* FETCH when used with the USING keyword
* any statement that does not require a stored section for execution
Any statement that is not coded as a parameter of one of the above
statements and requires a stored section in order to execute is a static
statement.
MPE/iX 5.0 Documentation