Previous chapters have described how to code various SQL statements directly into a program and have the database manager preprocess them. For some kinds of applications, however, it is desirable to execute SQL statements that are not known until the program is actually running. An example would be a program to support an interactive user who wishes to type queries and receive results at a terminal. In this case, you cannot embed the SQL statements in the program and have the DB2 Server for VSE & VM preprocessor recognize them, because the program reads the statements from a terminal when it is running. To support applications such as this, the system provides facilities for executing SQL statements that are specified at run time.
For a detailed description of each of these statements, see the DB2 Server for VSE & VM SQL Reference manual. The following SQL statements define dynamic statements.