DB2 Version 10.1 for Linux, UNIX, and Windows

Executing SQL statements in embedded SQL applications

The way you execute SQL statements in embedded SQL applications depends on if the statement is statically or dynamically executed. However, you must use the EXEC SQL command regardless of the type of statement that you use.

Static statements are hard-coded into the source code of an embedded SQL application. Dynamic statements are different from static in that they are compiled at run time and can be prepared with input parameters. Information that is read can be stored in a medium called a cursor, which then allows for users to freely scroll through the data and make suitable updates. Error information from the SQLCODE, SQLSTATE, and SQLWARN are a useful tool toward assisting in troubleshooting an application.