Using Dynamic SQL in COBOL

Restriction: This topic applies to Windows environments only.

Dynamic SQL refers to a special type of embedded SQL statement that is prepared and executed within an application program while the program is running. It differs from static embedded SQL in that part or all of the actual SQL commands may be stored in a host variable, whose value may change numerous times during execution of the program. In the extreme case, the SQL commands are generated in their entirety by the application program at run time.While dynamic SQL is more flexible than static embedded SQL, it does require additional overhead and more programming sophistication.