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 ...
Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.