


ADABAS statements cannot only be written statically into an application program, but also be dynamically generated or read in and executed during a program run. The SQL statements to be performed dynamically may contain host variables as input and output parameters.
Dynamic statements can also be executed in an ORACLE-compatible way. To do so, the corresponding sqlmode must be specified for precompilation. The syntax of the statements has therefore been extended. The statements described in the Reference manuals for the SQLMODE ORACLE must be used (see there).
Dynamic statements are processed in two steps or, when a descriptor is used, in three steps.
- The SQL statement specified as a parameter is prepared and named for its execution by means of the prepare statement. Host variables which possibly exist within the SQL statement to be prepared must be designated by question marks or are described via the descriptor.
- If the prepare statement stipulates that the host variables are to be described via a descriptor, the describe statement must be called afterwards. This statement generates an SQLDA (SQL-Descriptor-Area) and provides it with information that is needed for the parameter identification. Using this information, the user can associate appropriate program variable values with parameters.
- Once the prepare or describe statement is successfully executed, the prepared SQL statement can be performed. This is done by the SQL statement execute which requires
- the name qualified in the prepare statement for the SQL statement to be executed,
- the parameters to be included in place of the question marks. The usage of the descriptor must be indicated ('...using descriptor').
'execute immediate' offers another possibility of dynamically executing SQL statements. The statement to be performed does not need to be prepared with prepare, but it must not contain host variables.
See also:
exec sql [<n>] execute immediate


