Process non-SELECT statements

To build a dynamic SQL non-SELECT statement, you need to verify that the SQL statement you want to build is one that can be run dynamically and then build the SQL statement.

To run a dynamic SQL non-SELECT statement:

  1. Run the SQL statement using EXECUTE IMMEDIATE, or PREPARE the SQL statement, then EXECUTE the prepared statement.
  2. Handle any SQL return codes that might result.

The following is an example of an application running a dynamic SQL non-SELECT statement (stmtstrg):

  EXEC SQL
   EXECUTE IMMEDIATE :stmtstrg;
Related concepts
Dynamic SQL applications
Use interactive SQL