The EXECUTE IMMEDIATE statement runs the embedded SQL statement contained in the specified host variable.
EXECUTE IMMEDIATE :stmt_hvar
stmt_hvar
Is a character string host variable that contains a Transact-SQL statement.
The EXECUTE IMMEDIATE statement must conform to Transact-SQL statement rules. It cannot contain input parameter markers or host variables. It cannot return results. Results returned from this statement are discarded. Additionally, the statement cannot contain keywords that pertain exclusively to ESQL/C.
If any rows are returned, SQLCODE is set to +1, which indicates an exception.
strcpy(prep, "DELETE FROM mf_table WHERE name='elaine'");
EXEC SQL EXECUTE IMMEDIATE :prep;