DB2 - difference between static SQL and dynamic SQL

Static SQL

The static SQL statement is prepared before the program is executed and the operational form of the statement persists beyond the execution of the program. The source form of a static SQL statement is embedded within an application program written in a host language such as COBOL.

Dynamic SQL

Unlike static SQL, the dynamic statements are constructed and prepared at run time. The source form of a dynamic statement is a character string that is passed to DB2 by the program using the static SQL statement PREPARE or EXECUTE IMMEDIATE. Whether the operational form of the statement is persistent depends on whether dynamic statement caching is enabled.