When non-SELECT statements are issued dynamically, the coding task is relatively easy because there is no need to dynamically allocate main storage.
To issue a non-SELECT statement dynamically:
Be sure to handle any errors that result.
The following example executes an UPDATE statement that gives every employee a 10 percent raise:
MOVE 'update employee set payrate=payrate*1.10' TO SQLCMD EXEC SQL EXECUTE IMMEDIATE :sqlcmd END-EXEC ...