Dynamic operations offer a way to execute SQL commands that
cannot be completely defined until runtime. You accept part or
all of an SQL command that can be dynamically preprocessed from
the user, then use one of the following techniques to preprocess
and execute the command:
You can use the PREPARE command to preprocess it, then execute
it later during the same transaction using the EXECUTE command.
You can use the EXECUTE IMMEDIATE command to preprocess and
execute the dynamic command in one step.
FORTRAN does not support dynamic queries; only dynamic
non-queries may be dynamically prepared and executed.
The program accepts an SQL command from
the user and stores it in a host variable named
DynamicCommand.
EXEC SQL PREPARE DynamCommand FROM :DynamicCommand
After the command is prepared, the EXECUTE
command is executed.
EXEC SQL EXECUTE DynamCommand
.
.
.
|
Refer to the chapter, "Using Dynamic Operations", for further
explanation of the use of dynamic commands.