Executing SQL Statements
There are two main functions in DB2 ODBC for executing SQL statements: SQLExecDirect() and SQLExecute(). The SQLExecDirect() function prepares and executes a SQL statement similar to the SQL EXECUTE IMMEDIATE embedded dynamic SQL statement.
SQLRETURN SQLExecDirect (SQLHSTMT StatementHandle, SQLCHAR *Statement, SQLINTEGER StatementLength);
The SQLExecute() function requires that the statement be prepared using SQLPrepare() first. Once the statement has been prepared it can be executed many times, saving CPU resources.
SQLRETURN SQLPrepare (SQLHSTMT StatementHandle, SQLCHAR *Statement, SQLINTEGER StatementLength); SQLRETURN SQLExecute (SQLHSTMT StatementHandle);
Because the statement is dynamic, a program can put literal ...