To execute a dynamic SQL statement using the execute-immediate method, code your application to:
Store the text of the dynamic SQL statement in a character string host variable.
Call ct_dynamic with type as CS_EXEC_IMMEDIATE to initiate a command to execute the statement, buffer as the address of the string containing the SQL statement, and id as NULL.
Call ct_send to send the command to the server.
Call ct_results in a standard loop, as described in “Structure of the basic loop”. The value of the *result_type parameter indicates whether the command succeeded (CS_CMD_SUCCEED) or failed (CS_CMD_FAIL).