An entire Transact-SQL transaction, including variable declarations, control-of-flow language, and calls to stored procedures, can be coded as a single static SQL statement.
Static SQL statements can contain C-program host variables for input values and output data. Host variables are defined by the host C application and are accessible to the C and ESQL/C sections of your application. For more information about declaring and using host variables, see Using Host Variables and Using the SQLDA Data Structure.
When an SQL statement uses input host variables, the values of these variables are inserted in the statement before the statement runs. Output host variables are filled with the values returned after the statement runs.
Important Because Embedded SQL does not support alternate format rows, COMPUTE and COMPUTE BY clauses are ignored. If a statement returns multiple result sets, only the first result set is recognized; subsequent result sets are discarded. Also, if a statement returns more than one row, only the first row is recognized unless a cursor is used; subsequent rows are discarded.
At compile time, static SQL statements can be compiled as stored procedures into an access plan or executed as dynamic SQL statements. For more information about access plans and their alternatives, see Access Plans and Bind Files and Building Applications. When a static SQL statement contains only a single transaction-management command, such as BEGIN TRANSACTION, COMMIT TRANSACTION, ROLLBACK TRANSACTION, or SAVE TRANSACTION, the static SQL statement is not compiled into an access plan because stored procedures cannot contain unbalanced transaction-management statements. In these cases, at run time, the application issues unmatched transaction-management statements as dynamic SQL statements.
The rules for Transact-SQL stored procedures apply to static SQL statements.