Processing non-SELECT statements

Before building a dynamic SQL non-SELECT statement, you need to verify that this SQL statement is allowed to be run dynamically.

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;